Okipa / laravel-table

Generate tables from Eloquent models.
MIT License
532 stars 64 forks source link

Table generation script + architecture guide #32

Closed Okipa closed 4 years ago

Okipa commented 4 years ago

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'));
}
Okipa commented 4 years ago

Done in https://github.com/Okipa/laravel-table/pull/46