-
Copy App/Http/Controllers/GridsController.php.
-
Copy App/Http/Grids/Grids.php.
-
Copy public/js/grid.js and public/css/grid.css.
-
Copy resources/views/grid-template.blade.php.
-
Copy database/migrations/xxxx_xx_xx_xxxxxx_create_grids_table.php. and run 'php artisan migrate'
-
In layout, add paths of css and js.
-
In your routes/web.php, add following routes: Route::post('/save-grid-data/{gridID}/{entity}', 'GridController@store'); Route::delete('/save-grid-data/{gridID}/{entity}/{entityID}', 'GridController@destroy');
-
To create Grid, Create a file similar to App/Grids/SampleGrids.php - Write your query in 'QueryBuilder' method. - Map your columns in 'mapColumnsWithDB' method. - Provide array for the column display in 'getColumns' method. - and so on.
-
In your Controller,
use App\Grids\InvoicesGrids; public function datatableList(Request $request) { // create route for this $invoicesGrids = new InvoicesGrids(); return $invoicesGrids->getJSON(); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $invoicesGrids = new InvoicesGrids(); $dataGridHtml = $invoicesGrids->getHtml(); return view('your-view-name', compact('dataGridHtml')); }
-
Notifications
You must be signed in to change notification settings - Fork 0
bigbharatjain/LaravelGrid
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Implement Grid in Laravel 5.x
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published