31 lines
627 B
PHP
31 lines
627 B
PHP
<?php
|
|
|
|
namespace App\Domains\Analytics\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Click extends Model
|
|
{
|
|
public $timestamps = false;
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'clicked_at' => 'datetime',
|
|
];
|
|
|
|
// Prevent updates — clicks are append-only
|
|
public function save(array $options = []): bool
|
|
{
|
|
if ($this->exists) {
|
|
throw new \LogicException('Click records are append-only.');
|
|
}
|
|
return parent::save($options);
|
|
}
|
|
|
|
public function link()
|
|
{
|
|
return $this->belongsTo(\App\Domains\Link\Models\Link::class);
|
|
}
|
|
}
|