laravel-modules icon indicating copy to clipboard operation
laravel-modules copied to clipboard

Scan additional folders for modules not working with database seeders

Open limsocheat opened this issue 1 year ago • 3 comments

I followed this documentation to add additional folders for modules. I enabled scan->enabled to true, added autoload to composer.json, created module inside folder Connectors\Thalias, and enabled module.

I created a seeder inside Database\Seeders, then I ran the command: php artisan module:seed Thalias. Terminal return success, but the seed is not running.

So I had to run the command: "php artisan db:seed --class=Connectors\\Thalias\\Database\\Seeders\\ThaliasDatabaseSeeder" manually.

How to fix this issue? thanks.

limsocheat avatar May 27 '24 08:05 limsocheat

I face the same matters

HanustaviraGA avatar Sep 06 '24 22:09 HanustaviraGA

What I did is to add the seeder insider the existing seeder inside the module e.g

namespace Modules\User\Database\Seeders;

use Modules\User\Database\Seeders\BouncerDataSeeder;
use Illuminate\Database\Seeder;

class UserDatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        
        // Call the BouncerDataSeeder from the User module
        $this->call(BouncerDataSeeder::class);
    }
}

MuhammadTaha avatar May 15 '25 10:05 MuhammadTaha

https://github.com/nWidart/laravel-modules/issues/465#issuecomment-892680947

ctf0 avatar Aug 25 '25 21:08 ctf0