- Add explicit $table property to all Eloquent models with Dutch names - Fix pivot table names in belongsToMany relationships - Fix seeder: use valid enum values for afhankelijkheden status Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
52 lines
1.0 KiB
PHP
52 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\CommitmentStatus;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class Commitment extends Model
|
|
{
|
|
protected $table = 'commitments';
|
|
|
|
protected $fillable = [
|
|
'project_id',
|
|
'besluit_id',
|
|
'beschrijving',
|
|
'eigenaar_id',
|
|
'deadline',
|
|
'status',
|
|
'bron',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => CommitmentStatus::class,
|
|
'deadline' => 'date',
|
|
];
|
|
}
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function besluit(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Besluit::class);
|
|
}
|
|
|
|
public function eigenaar(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'eigenaar_id');
|
|
}
|
|
|
|
public function acties(): HasMany
|
|
{
|
|
return $this->hasMany(Actie::class);
|
|
}
|
|
}
|