LAR_Maintenance/app/Models/Activity.php
JonatanRek 571df9a0a4 Fixes
2024-07-30 18:13:21 +02:00

47 lines
848 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use App\Observers\ActivityObserver;
class Activity extends Model
{
use HasFactory;
protected $casts = [
'data' => 'array',
];
const UPDATED_AT = null;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'ip',
'user_id',
'affected_type',
'affected_id',
'lang_text',
'data',
];
protected static function booted()
{
Activity::observe(ActivityObserver::class);
}
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
public function affected()
{
return $this->morphTo('affected');
}
}