Prop-Model
app/Models/Contact.phpuse Illuminate\Database\Eloquent\Relations\MorphMany;
use Nfgarching\Core\Models\Prop;
public function props(): MorphMany
{
return $this->morphMany(Prop::class, 'model');
}
// Verwendung
$contact->props()->create([
'key' => 'iban_1', 'state' => 'verified', 'type' => 'iban',
'label' => 'Privat', 'value' => 'DE00 0000 0000 0000 0000 00',
]);
Die Tabelle props legt die Anwendung an (database/migrations/…_create_props_table.php): id, model_type, model_id, key, state, type, label, value, data (JSON), memo.
- Props
- 40
- Kontakte mit Props
- 10
state
active: 8 error: 8 pending: 8 unverified: 8 verified: 8
type
birth_date: 10 death_date: 10 iban: 10 metadata: 10
CRUD-Seiten des Packages
Die Routen core.props.* liegen in der Rollengruppe admin. Mit spatie/laravel-permission hängt RouteRoles deshalb role:admin an – nur das Demo-Konto Admin kommt hinein, alle anderen erhalten 403.
Melde dich als Admin an, um die Prop-Verwaltung zu öffnen.
Dokumentation auf GitHub (README.md#prop-model)