Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 5m0s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 5m0s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 4m50s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 4m33s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 6m11s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 6m46s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 6m24s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 5m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m17s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
35 lines
939 B
PHP
35 lines
939 B
PHP
<?php
|
||
|
||
namespace Inhaus\Plugins\Pages\Models;
|
||
|
||
use App\Models\User;
|
||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||
use Illuminate\Database\Eloquent\Model;
|
||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
||
/**
|
||
* Baustein (kind = block): ein Inhalt, der auf vielen Seiten eingebunden wird –
|
||
* Änderungen wirken überall. Vorlage (kind = template): Ausgangsinhalt für neue Seiten.
|
||
*/
|
||
#[Fillable(['kind', 'name', 'description', 'content', 'created_by', 'updated_by'])]
|
||
class ContentSnippet extends Model
|
||
{
|
||
public const BLOCK = 'block';
|
||
|
||
public const TEMPLATE = 'template';
|
||
|
||
public const KINDS = [self::BLOCK => 'Baustein', self::TEMPLATE => 'Vorlage'];
|
||
|
||
protected function casts(): array
|
||
{
|
||
return ['content' => 'array'];
|
||
}
|
||
|
||
/**
|
||
* @return BelongsTo<User, $this>
|
||
*/
|
||
public function editor(): BelongsTo
|
||
{
|
||
return $this->belongsTo(User::class, 'updated_by');
|
||
}
|
||
}
|