SAFweb2-Release 2.1.17
Views
Detail View
Im Controller:
public function show(Role $role)
{
return view('admin::roles.show', ['model' => $role]);
}
In der Show-View:
Die High-Level-View benötigt das
- $model
- optional: Buttons via x-slot
<x-core::pagesections.detail_view :model="$model">
<x-layout>
<x-core::pagesections.detail_view :model="$model">
{{-- Felder --}}
<x-safweb.forms.info autofocus tabindex="1" name="{{ __('role') }}" :value="$model->name" size="40" />
<x-safweb.forms.info tabindex="2" name="{{ __('description') }}" :value="$model->description" size="40" />
{{-- komplett optional für weitere Buttons: --}}
<x-slot:buttons>
<a href="{{ request()->url() }}/edit" role="button" class="py-1.5 mx-2 px-6 bg-ctrl-green text-ctrl-dark hover:bg-green-300">
{{ __('edit') }}<i class="fa fa-pencil-alt ml-2"></i>
</a>
<a onclick="return confirm('{{ __('confirm delete') }}')"
href="{{ request()->url() }}/delete" role="button" class="py-1.5 mx-2 px-6 bg-ctrl-red text-white hover:bg-red-400"
>
{{ __('delete') }}<i class="fa fa-trash ml-2"></i>
</a>
</x-slot:buttons>
</x-core::pagesections.detail_view>
</x-layout>
Es müssen nur noch die Felder angegeben werden, der Rest wird automatisch gesetzt.
Edit View
Die High-Level-View benötigt das
- $model
- die action route
- optional: Buttons via x-slot
<x-core::pagesections.edit_view :model="$model" action="{{ route(‘admin.role.update’, $model->id) }}">
Im Controller
public function edit(Role $role)
{
return view('admin::roles.edit', ['model' => $role]);
}
In der View
<x-layout>
<x-core::pagesections.edit_view :model="$model" action="{{ route('admin.role.update', $model->id) }}">
<x-safweb.forms.input autofocus tabindex="1" name="name" size="30" value="{{ $model->name }}"/>
<x-safweb.forms.input tabindex="2" name="description" size="60" value="{{ $model->description }}"/>
</x-core::pagesections.edit_view>
</x-layout>
Auch hier, momentan nur die Felder hinzufügen.