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
|
|
@ -2,12 +2,22 @@
|
|||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class AdminController extends Controller
|
||||
class AdminController extends BaseController
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view("admin.admin.index");
|
||||
}
|
||||
protected $_datatable = [
|
||||
'model' => \App\Models\Admin::class,
|
||||
'default_sort' => 'id',
|
||||
'columns' => [
|
||||
'id' => '#',
|
||||
'username' => 'Username',
|
||||
'created_at' => 'Created',
|
||||
'updated_at' => 'Updated',
|
||||
],
|
||||
'sort_columns' => [
|
||||
'id' => 'id',
|
||||
'username' => 'username',
|
||||
'created_at' => 'created_at',
|
||||
'updated_at' => 'updated_at',
|
||||
]
|
||||
];
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue