48 lines
977 B
PHP
48 lines
977 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Models\Client;
|
|
use App\Models\User;
|
|
|
|
class ClientActivityTimeline extends Model
|
|
{
|
|
protected $table = 'client_activity_timeline';
|
|
public $timestamps = false; // Only using created_at
|
|
|
|
protected $fillable = [
|
|
'client_id',
|
|
'actor_type',
|
|
'actor_user_id',
|
|
'event_type',
|
|
'entity_type',
|
|
'entity_id',
|
|
'title',
|
|
'description',
|
|
'metadata',
|
|
'created_at'
|
|
];
|
|
|
|
protected $casts = [
|
|
'metadata' => 'array',
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
public function client()
|
|
{
|
|
return $this->belongsTo(Client::class);
|
|
}
|
|
|
|
public function actor()
|
|
{
|
|
return $this->belongsTo(User::class, 'actor_user_id');
|
|
}
|
|
|
|
// Polymorphic relation to entity if we had models for all of them
|
|
// public function entity()
|
|
// {
|
|
// return $this->morphTo();
|
|
// }
|
|
}
|