- Bilder mit automatischen WebP-Webgrößen (640/1280/2048 px), Sortierung per Drag & Drop, Mehrfach-Upload, Import-Befehl photos:import - Webseiten-Texte als feste, bearbeitbare Bausteine (config/content.php), Rich-Text bereinigt ausgegeben - Ausstattung und FAQ aus der bisherigen Webseite übernommen - Rolle Inhalte hat Zugriff auf alle Webseiten-Bereiche Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
927 B
PHP
40 lines
927 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\FaqFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Scope;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
#[Fillable(['question', 'answer', 'is_published', 'sort_order'])]
|
|
class Faq extends Model
|
|
{
|
|
/** @use HasFactory<FaqFactory> */
|
|
use HasFactory;
|
|
|
|
/**
|
|
* Get the attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'is_published' => 'boolean',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @param Builder<Faq> $query
|
|
* @return Builder<Faq>
|
|
*/
|
|
#[Scope]
|
|
protected function published(Builder $query): Builder
|
|
{
|
|
return $query->where('is_published', true)->orderBy('sort_order');
|
|
}
|
|
}
|