1
0
Fork 0

Adding card controller for administrators

This commit is contained in:
Henrik Hautakoski 2022-01-08 16:39:04 +01:00
parent b09bed4a34
commit 086bd81702
2 changed files with 47 additions and 0 deletions

View file

@ -0,0 +1,22 @@
<?php
namespace App\Http\Controllers\Admin;
use App\Models\Card;
use App\Http\Controllers\Controller;
class CardController extends Controller
{
public function index()
{
return view("admin.card.index");
}
public function destroy(Card $card)
{
$card->delete();
return redirect()->route('admin.card.index');
}
}

View file

@ -0,0 +1,25 @@
<x-layout name="admin">
<div class="mb-4">
<x-button href="{{ route('admin.card.create') }}" type="info">{{ __('New') }}</x-button>
</div>
@livewire('datatable', [
'model' => \App\Models\Card::class,
'default_sort' => 'id',
'route_edit' => 'admin.card.edit',
'route_delete' => 'admin.card.delete',
'columns' => [
'id' => '#',
'body' => 'Body',
'subject' => 'Subject',
'subject_type' => 'Subject Type',
'raid.name' => 'Raid',
],
'sort_columns' => [
'id' => 'id',
'body' => 'body',
]
])
</x-layout>