fixed filament resource forms

This commit is contained in:
2025-09-10 19:28:16 +02:00
parent 837155f54c
commit 40aa5fc188
10 changed files with 317 additions and 12 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Photo extends Model
{
@@ -14,9 +15,36 @@ class Photo extends Model
'metadata' => 'array',
];
// Accessor für die Kompatibilität mit der PhotoResource
public function getImagePathAttribute()
{
return $this->file_path;
}
// Mutator für die Kompatibilität mit der PhotoResource
public function setImagePathAttribute($value)
{
$this->attributes['file_path'] = $value;
}
public function event(): BelongsTo
{
return $this->belongsTo(Event::class);
}
public function emotion()
{
return $this->belongsTo(Emotion::class);
}
public function task()
{
return $this->belongsTo(Task::class);
}
public function likes(): HasMany
{
return $this->hasMany(\App\Models\PhotoLike::class);
}
}