Skip to content
Icon

WARNING You're browsing the documentation for an upcoming version of Laravel DataTables. The documentation and features of this release are subject to change.

DataTables Editor Model

DataTables Editor requires a Eloquent Model that will be used for our CRUD operations.

{tip} All CRUD operations of Editor uses database transaction.

Setup Model

Just set the $model property of your editor class to your model's FQCN.

namespace App\DataTables\Editors;
 
use App\User;
use Yajra\DataTables\DataTablesEditor;
 
class UsersDataTablesEditor extends DataTablesEditor
{
protected $model = User::class;
}

Fillable Property

Don't forget to set your model's fillable property. The Editor's basic crud operation relies on this. For advance operations like saving relations, use the Editors Event Hooks.

class User extends Model {
protected $fillable = [
'name',
'email',
'password',
];
}