- 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>
54 lines
1.0 KiB
PHP
54 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
class Document extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'documents';
|
|
|
|
protected $fillable = [
|
|
'project_id',
|
|
'fase_id',
|
|
'titel',
|
|
'type',
|
|
'inhoud',
|
|
'bestandspad',
|
|
'versie',
|
|
'auteur_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'versie' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function fase(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Fase::class);
|
|
}
|
|
|
|
public function auteur(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'auteur_id');
|
|
}
|
|
|
|
public function tags(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(Tag::class, 'document_tag');
|
|
}
|
|
}
|