zobay
zobay

Reputation: 106

Reorder operation is not working in backpack for laravel

Reorder operation is not working in backpack for laravel.

Migration file:

 public function up()
    {
        Schema::table('complexities', function (Blueprint $table) {
            $table->integer('parent_id')->default(0)->nullable();
            $table->integer('lft')->default(0)->nullable();
            $table->integer('rgt')->default(0)->nullable();
            $table->integer('depth')->default(0)->nullable();
        });
    }

Crud controller

use ReorderOperation;
..........
.........
protected function setupReorderOperation()
    {
        $this->crud->set('reorder.label', 'title');
        $this->crud->set('reorder.max_level', 2);
    }

I am getting the Reorder UI, But it is not working. I mean can reorder the list, But no effect in database and list becomes in old order when I reload it.

Upvotes: 0

Views: 416

Answers (1)

o15a3d4l11s2
o15a3d4l11s2

Reputation: 4059

Not sure about the nullable on all fields. Please try with

public function up()
{
    Schema::table('complexities', function (Blueprint $table) {
        $table->integer('parent_id')->nullable()->default(0);
        $table->integer('lft')->default(0);
        $table->integer('rgt')->default(0);
        $table->integer('depth')->default(0);
    });
}

Also check if there are any values stored for these fields in the database.

Upvotes: 1

Related Questions