Using DataTables Editor

All actions requested by DataTables Editor are being submitted via POST ajax request. This means, that we need to create a post request route that will handle all the actions we need.

This doc assumes that you are already knowlegeable of DataTables Editor library.

Create your Editor

You can create your editor using artisan command.

php artisan datatables:editor Users

Setup Editor Model

See editor model docs for ref:

Setup Editor Rules

See editor rules docs for ref:

Register Route Handler

use App\DataTables\UsersDataTablesEditor;

Route::post('editor', function(UsersDataTablesEditor $editor) {
    return $editor->process(request());

Setup AJAX csrf-token

Since actions are being sent via post, we need to make sure that we setup csrf-token. Just add the snippets below before your scripts to avoid csrf errors:

    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

Setup your content

You can use DataTables Editor Generator to help you speed-up the process. Once generated, copy the necessary scripts and html on your blade template.