CluPilotCloud/app/Models/DpaAcceptance.php

43 lines
1.1 KiB
PHP

<?php
namespace App\Models;
use App\Models\Concerns\HasUuid;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
/**
* That a customer accepted a particular version, when, and from where.
*
* Evidence, so nothing here is ever updated: a new version means a new row. What
* makes it evidence rather than a flag is the three fields beside the link — the
* moment, the address it came from, and the login that pressed the button.
*/
class DpaAcceptance extends Model
{
use HasFactory, HasUuid;
protected $fillable = ['customer_id', 'dpa_version_id', 'user_id', 'ip', 'accepted_at'];
protected function casts(): array
{
return ['accepted_at' => 'datetime'];
}
public function customer(): BelongsTo
{
return $this->belongsTo(Customer::class);
}
public function version(): BelongsTo
{
return $this->belongsTo(DpaVersion::class, 'dpa_version_id');
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
}