49 lines
903 B
PHP
49 lines
903 B
PHP
<?php
|
|
|
|
namespace Modules\AssetExchange\Models;
|
|
|
|
use App\Business;
|
|
use App\Contact;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Offer extends Model
|
|
{
|
|
protected $table = 'aex_offers';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'listing_id',
|
|
'deal_id',
|
|
'buyer_contact_id',
|
|
'amount',
|
|
'status',
|
|
'message',
|
|
'expires_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'amount' => 'integer',
|
|
'expires_at' => 'datetime',
|
|
];
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function listing()
|
|
{
|
|
return $this->belongsTo(Listing::class, 'listing_id');
|
|
}
|
|
|
|
public function deal()
|
|
{
|
|
return $this->belongsTo(Deal::class, 'deal_id');
|
|
}
|
|
|
|
public function buyer()
|
|
{
|
|
return $this->belongsTo(Contact::class, 'buyer_contact_id');
|
|
}
|
|
}
|