summaryrefslogtreecommitdiff
path: root/src/Http/Models/AccessLog.php
blob: cdfef4bb29bd046fd74490d19c771c01d6e13de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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'));
    }
}