fixed filament resource forms
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user