简体   繁体   中英

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM