romegasoftware/Multitenancy

Tenant::createMany not found, can't get it to work

Closed this issue · 1 comments

After doing everything right according to the readme, I get the following error:

Call to undefined method RomegaDigital\Multitenancy\Models\Tenant::createMany()

When attempting:

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use RomegaDigital\Multitenancy\Models\Tenant;

class TestController extends Controller
{
    public function __invoke()
    {
        Tenant::createMany([
            [
                'name' => 'An Identifying Name',
                'domain' => 'tenant1'
            ],
            [
                'name' => 'A Second Customer',
                'domain' => 'tenant2'
            ]
        ]);
    }
}

You are right. There is no createMany() method on the Model class instance. I changed the documentation. If you created a Tenant factory, however, you can call factory(Tenant::class)->createMany([...]).

Sorry for replying this late!