ldc-qrcollector-back/app/Models/UrlStats.php

46 lines
825 B
PHP
Raw Permalink Normal View History

2023-03-28 14:37:49 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class UrlStats extends Model
{
use HasFactory;
/**
* The attributes that are mass assignable.
*
2026-02-12 16:09:21 +01:00
* @var list<string>
2023-03-28 14:37:49 +00:00
*/
protected $fillable = [
'calls',
'date',
'url_key',
'url',
2023-03-28 14:37:49 +00:00
];
/**
* The attributes that should be cast.
*
* @var array<string, string>
*/
protected $casts = [
'date' => 'date',
];
/**
* Perform any actions required after the model boots.
*
* @return void
*/
protected static function booted(): void
{
static::creating(function (self $model) {
$model->calls = 1;
$model->date = now();
});
}
2023-03-28 14:37:49 +00:00
}