roles-permissions-laravel icon indicating copy to clipboard operation
roles-permissions-laravel copied to clipboard

Error seeding database

Open bellwood opened this issue 7 years ago • 4 comments

 Create Roles for user, default is admin and user? [y|N] (yes/no) [yes]:
 >

 Enter roles in comma separate format. [Admin,User]:
 >
In Connection.php line 664:

  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: roles.guard_name (SQL: insert into "roles" ("name", "updated_at", "created_at") values (Admin, 2017-12-04 13:12:50, 2017-12-04 13:12:50))


In Connection.php line 458:

  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: roles.guard_name

Edit:

Laravel 5.5.22 PHP 7.0.15

Following the blog article

bellwood avatar Dec 04 '17 13:12 bellwood

just fill:

Enter roles in comma separate format. [Admin,User]:
 >Admin,User,Author

and press enter

diorz38 avatar Jul 16 '18 22:07 diorz38

I think the issue is that [Admin,User] implies it will be the default if you just hit enter, perhaps catch null input or make those the defaults if just enter is given?

bellwood avatar Jul 17 '18 13:07 bellwood

 Create Roles for user, default is admin and user? [y|N] (yes/no) [yes]:
 >

 Enter roles in comma separate format. [Admin,User]:
 >
In Connection.php line 664:

  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: roles.guard_name (SQL: insert into "roles" ("name", "updated_at", "created_at") values (Admin, 2017-12-04 13:12:50, 2017-12-04 13:12:50))


In Connection.php line 458:

  SQLSTATE[23000]: Integrity constraint violation: 19 NOT NULL constraint failed: roles.guard_name

Edit:

Laravel 5.5.22 PHP 7.0.15

Following the blog article

While the issues is occured

Enter roles in comma separate format. [Admin,User]: Enter the list of roles used in your application such as Admin,User,Editor,Publisher

ManojKiranA avatar Mar 06 '19 12:03 ManojKiranA

In App/Providers/AppServiceProvider.php

use below code

<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        Schema::defaultStringLength(191);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

SanthoshSiddegowda avatar Apr 08 '19 10:04 SanthoshSiddegowda