Archived
1
0
Fork 0

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:
Henrik Hautakoski 2022-01-24 22:30:38 +01:00
parent 6482020dfd
commit 0c493c2978
8 changed files with 76 additions and 116 deletions

View file

@ -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',
]
];
}