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,27 @@ namespace App\Http\Controllers\Admin;
|
|||
use App\Models\Character;
|
||||
use App\Http\Livewire\Form\CharacterForm;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class CharacterController extends Controller
|
||||
class CharacterController extends BaseController
|
||||
{
|
||||
protected $_datatable = [
|
||||
'model' => Character::class,
|
||||
'default_sort' => 'id',
|
||||
'route_create' => 'admin.character.create',
|
||||
'route_edit' => 'admin.character.edit',
|
||||
'delete_enabled' => true,
|
||||
'restore_enabled' => true,
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'name' => 'Name',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'name' => 'name',
|
||||
]
|
||||
];
|
||||
|
||||
static public function getForm() : string
|
||||
{
|
||||
return CharacterForm::class;
|
||||
}
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view("admin.character.index");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue