Skip to content

[9.x] Fix artisan make:seeder command nested namespace and class name problem#41534

Merged
taylorotwell merged 4 commits into
laravel:9.xfrom
m-mohammadi1:fix-seeders
Mar 17, 2022
Merged

[9.x] Fix artisan make:seeder command nested namespace and class name problem#41534
taylorotwell merged 4 commits into
laravel:9.xfrom
m-mohammadi1:fix-seeders

Conversation

@m-mohammadi1

Copy link
Copy Markdown
Contributor

Personally I used to structure my seeders for different parts like Auth part (for rules, permissions and users) and etc ...
but when I use

php artisan make:seeder Auth/Permissions/SomePermissionSeeder

The result is like this:

<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class Auth/Permissions/SomePermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //
    }
}

and as you can see the namespace and class name are not correct.
after the change the result will be like this:

<?php

namespace Database\Seeders\Auth\Permissions;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class SomePermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //
    }
}

I have changed the make:seeder command class and you can see it.
And then we can structure our seeders with artisan console command with right namespace and class name.

@m-mohammadi1 m-mohammadi1 changed the title fix artisan make:seeder command nested namespace and class name problem [9.x] fix artisan make:seeder command nested namespace and class name problem Mar 17, 2022
@m-mohammadi1 m-mohammadi1 changed the title [9.x] fix artisan make:seeder command nested namespace and class name problem [9.x] Fix artisan make:seeder command nested namespace and class name problem Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants