Adding card controller for administrators
This commit is contained in:
parent
b09bed4a34
commit
086bd81702
2 changed files with 47 additions and 0 deletions
22
app/Http/Controllers/Admin/CardController.php
Normal file
22
app/Http/Controllers/Admin/CardController.php
Normal 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');
|
||||
}
|
||||
}
|
||||
25
resources/views/admin/card/index.blade.php
Normal file
25
resources/views/admin/card/index.blade.php
Normal 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>
|
||||
Loading…
Add table
Add a link
Reference in a new issue