diff options
author | Sam Light <sam@lightscale.co.uk> | 2025-04-09 21:34:16 +0100 |
---|---|---|
committer | Sam Light <samlight1994@gmail.com> | 2025-04-09 21:34:16 +0100 |
commit | 73083c611f1ddcc41ec712d5f4448df1270bc176 (patch) | |
tree | e1762d8c9862b4c97f52923c735ed509ebf3d4c6 /src/Http/Models/AccessLog.php | |
parent | 95d4b113c42764a2df09852d31c3bc33e2047d0d (diff) |
Created migration, Model, Middleware, config
Diffstat (limited to 'src/Http/Models/AccessLog.php')
-rw-r--r-- | src/Http/Models/AccessLog.php | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/Http/Models/AccessLog.php b/src/Http/Models/AccessLog.php new file mode 100644 index 0000000..cdfef4b --- /dev/null +++ b/src/Http/Models/AccessLog.php @@ -0,0 +1,33 @@ +<?php + +namespace Lightscale\LaralightAccessLog\Models; + +use Illuminate\Database\Eloquent\Model; + +class AccessLog extends Model +{ + const UPDATED_AT = null; + + protected array $guarded = [ + 'user_id' + ]; + + public function __construct(array $attributes = []) + { + $this->setTable(config('access_log.table_name')); + + parent::__construct($attributes); + } + + protected function cast(): array + { + return [ + 'properties' => 'collection', + ] + } + + public function user(): BelongsTo + { + return $this->belongsTo(config('access_log.user_model')); + } +} |