43 lines
785 B
PHP
43 lines
785 B
PHP
<?php
|
|
|
|
namespace Modules\AssetExchange\Models;
|
|
|
|
use App\Business;
|
|
use App\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class PipelineEvent extends Model
|
|
{
|
|
protected $table = 'aex_pipeline_events';
|
|
|
|
protected $fillable = [
|
|
'business_id',
|
|
'entity_type',
|
|
'entity_id',
|
|
'event_type',
|
|
'description',
|
|
'user_id',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'entity_id' => 'integer',
|
|
'metadata' => 'array',
|
|
];
|
|
|
|
public function business()
|
|
{
|
|
return $this->belongsTo(Business::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function entity()
|
|
{
|
|
return $this->morphTo(__FUNCTION__, 'entity_type', 'entity_id');
|
|
}
|
|
}
|