yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.76k stars 859 forks source link

Error when using NestableTrait #2059

Closed josegus closed 1 year ago

josegus commented 5 years ago

Summary of problem or feature request

I recently installed https://github.com/atayahmet/laravel-nestable and added NestableTrait to my model "Categoria". This is causing an issue, returning "No available engine for App\Categoria" message. I really need to use both (datatables and nestable). Any idea how can i make both work correctly?

I have not run "vendor publish" for datatables, since I don't need customization. I have other models (Producto, Cliente) working the same: ajax and using datatables() helper, but without NestableTrait.

Code snippet of problem

I'm using ajax, so my code looks like:

    // Ajax method
    public function list(Request $request)
    {
        $query = Categoria::select(['id', 'nombre']);

        return datatables($query)->toJson();
    }

And my Categoria model:

class Categoria extends Model
{
    use NestableTrait;

    protected $table = 'categoria';

    protected $fillable = ['nombre', 'slug', 'icono', 'descripcion', 'categoria_id'];

    protected $hidden = ['created_at', 'updated_at'];
}

System details

yajra commented 5 years ago

Self joins is not yet supported by the package. There is a PR that address this but it breaks on the soft deletes model and was reverted https://github.com/yajra/laravel-datatables/pull/2051.

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 7 days since being marked as stale.