2025-11-10 22:47:08 +01:00

41 lines
739 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Log extends Model
{
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'description',
'type'
];
/**
* Creating new log
* @param string $descpr
* @return void
*/
public static function writeLog(string $descpr, string $type = 'access')
{
self::create(['description' => $descpr, 'type' => $type]);
}
/**
* Get the attributes that should be cast.
*
* @return array<string, string>
*/
protected function casts(): array
{
return [
'created_at' => 'datetime'
];
}
}