Teilnahmerechnungen erstellen
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Scopes\CommonModel;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
/**
|
||||
* Ein Block einer Dokumentvorlage. Bewusst `CommonModel` (kein `SiteScope`): die Vorlage gilt app-weit,
|
||||
* tenant-spezifisch sind nur die eingesetzten Werte.
|
||||
*
|
||||
* @property string $document_type
|
||||
* @property string $block
|
||||
* @property string|null $content
|
||||
* @property int $sort_order
|
||||
* @property bool $editable
|
||||
*/
|
||||
class DocumentTemplate extends CommonModel
|
||||
{
|
||||
public const string TYPE_PARTICIPANT_INVOICE = 'participant_invoice';
|
||||
|
||||
/** Seitengerüst -- enthält die `{block:...}`-Platzhalter und bestimmt damit die Anordnung. */
|
||||
public const string BLOCK_LAYOUT = 'layout';
|
||||
|
||||
/** CSS des Dokuments. */
|
||||
public const string BLOCK_STYLE = 'style';
|
||||
|
||||
/** Der generierte Teil (Positionstabelle, Summen, Schlusssatz) -- nicht editierbar. */
|
||||
public const string BLOCK_BODY = 'body';
|
||||
|
||||
protected $table = 'document_templates';
|
||||
|
||||
protected $fillable = [
|
||||
'document_type',
|
||||
'block',
|
||||
'content',
|
||||
'sort_order',
|
||||
'editable',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'sort_order' => 'integer',
|
||||
'editable' => 'boolean',
|
||||
];
|
||||
|
||||
/**
|
||||
* Alle Blöcke einer Dokumentart, nach Block-Slug adressierbar.
|
||||
*
|
||||
* @return Collection<string, self>
|
||||
*/
|
||||
public static function forType(string $documentType): Collection
|
||||
{
|
||||
return self::where('document_type', $documentType)
|
||||
->orderBy('sort_order')
|
||||
->get()
|
||||
->keyBy('block');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user