initial: bootstrap from BukidBountyApp base
This commit is contained in:
46
app/Models/Property/Property.php
Normal file
46
app/Models/Property/Property.php
Normal file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models\Property;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\User;
|
||||
|
||||
class Property extends Model
|
||||
{
|
||||
protected ?string $table = 'properties';
|
||||
|
||||
protected array $fillable = [
|
||||
'hashkey',
|
||||
'name',
|
||||
'location',
|
||||
'price',
|
||||
'status',
|
||||
'details',
|
||||
'is_active',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'details' => 'json',
|
||||
'price' => 'decimal:2',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function referrals()
|
||||
{
|
||||
return $this->hasMany(Referral::class, 'property_id');
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function updater()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
57
app/Models/Property/Referral.php
Normal file
57
app/Models/Property/Referral.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models\Property;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\User;
|
||||
|
||||
class Referral extends Model
|
||||
{
|
||||
protected ?string $table = 'referrals';
|
||||
|
||||
protected array $fillable = [
|
||||
'hashkey',
|
||||
'property_id',
|
||||
'referrer_id',
|
||||
'referred_id',
|
||||
'referred_name',
|
||||
'referred_contact',
|
||||
'status',
|
||||
'details',
|
||||
'is_active',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'details' => 'json',
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function property()
|
||||
{
|
||||
return $this->belongsTo(Property::class, 'property_id');
|
||||
}
|
||||
|
||||
public function referrer()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'referrer_id');
|
||||
}
|
||||
|
||||
public function referred()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'referred_id');
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function updater()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
41
app/Models/Property/ReferralKey.php
Normal file
41
app/Models/Property/ReferralKey.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models\Property;
|
||||
|
||||
use App\Models\Model;
|
||||
use App\Models\User;
|
||||
|
||||
class ReferralKey extends Model
|
||||
{
|
||||
protected ?string $table = 'referral_keys';
|
||||
|
||||
protected array $fillable = [
|
||||
'hashkey',
|
||||
'user_id',
|
||||
'key',
|
||||
'is_active',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
protected array $casts = [
|
||||
'is_active' => 'boolean',
|
||||
];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function creator()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'created_by');
|
||||
}
|
||||
|
||||
public function updater()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'updated_by');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user