Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

modevelops's avatar

How to register a service provider?

Hello,

I want to use https://github.com/lazychaser/laravel-nestedset#installation in my project. So I run the composer command as mentioned in the installation manual. Then I wanted to use the Blueprint-Makro $table->nestetSet() in my migration. Running "php artisan migrate" results in an error message

In Macroable.php line 96:

  Method nestetSet does not exist.

So I guess I have to register the NestedSetServiceProvider provider?! I added

Kalnoy\Nestedset\NestedSetServiceProvider::class,

to my app/config.php provider-array. I still get the error.

Here is my migration class

<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGroupsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('groups', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->unique();
            $table->string('abbreviation');
            $table->nestetSet();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('groups');
    }
}

Did I miss a basic step? I'm using Laravel 5.5.

0 likes
2 replies
modevelops's avatar

Oh, I just found my mistake. Little typo nestetSet instead of nestedSet.

skliche's avatar
skliche
Best Answer
Level 42

Typo ... nestetSet() should be nestedSet()

Please or to participate in this conversation.