Setup table generation script that could be like : php artisan make:table UsersTable --model=User.
This script would generate a Table class in the app/Tables directory, in which we could configure the table generation and behaviour instead of doing it in a controller or in a service.
Once it would be done, we could call our table like this in our controller :
public function index()
{
$table = new UsersTable($request);
return view('templates.admin.users.index', compact('table'));
}
Setup table generation script that could be like :
php artisan make:table UsersTable --model=User
.This script would generate a
Table
class in theapp/Tables
directory, in which we could configure the table generation and behaviour instead of doing it in a controller or in a service.Once it would be done, we could call our table like this in our controller :