- DB: users.username (unique), users.preferred_locale (default from app.locale) - Backend: validation, model fillable; share supportedLocales; SetLocaleFromUser - Frontend: profile page fields + types - Filament: SuperAdmin profile page with username/language feat(admin-nav): move Tasks to Bibliothek and add menu labels fix(tasks-table): show localized title/emotion/event type; add translated headers feat(l10n): add missing table headers for emotions and event types; normalize en/de files refactor: tidy translations for tasks/emotions/event types
52 lines
1.1 KiB
PHP
52 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class Photo extends Model
|
|
{
|
|
protected $table = 'photos';
|
|
protected $guarded = [];
|
|
protected $casts = [
|
|
'is_featured' => 'boolean',
|
|
'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);
|
|
}
|
|
}
|
|
|