app/Http/Controllers/Admin/*Controller.php: refactoring so that all controllers share similar code by inheriting from BaseController and set $_datatable property.
This commit is contained in:
parent
6482020dfd
commit
0c493c2978
8 changed files with 76 additions and 116 deletions
|
|
@ -5,17 +5,32 @@ namespace App\Http\Controllers\Admin;
|
|||
use App\Models\Card;
|
||||
use App\Http\Livewire\Form\CardForm;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class CardController extends Controller
|
||||
class CardController extends BaseController
|
||||
{
|
||||
protected $_datatable = [
|
||||
'model' => Card::class,
|
||||
'default_sort' => 'id',
|
||||
'route_create' => 'admin.card.create',
|
||||
'route_edit' => 'admin.card.edit',
|
||||
'delete_enabled' => true,
|
||||
'restore_enabled' => true,
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'body' => 'Body',
|
||||
'subject' => 'Subject',
|
||||
'subject_type' => 'Subject Type',
|
||||
'raid.name' => 'Raid',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'body' => 'body',
|
||||
'subject' => ['character.name', 'class', 'role'],
|
||||
'raid.name' => 'raid.name',
|
||||
]
|
||||
];
|
||||
|
||||
static public function getForm() : string
|
||||
{
|
||||
return CardForm::class;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('admin.card.index');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue