roles-permissions-laravel
roles-permissions-laravel copied to clipboard
Error seeding database
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
just fill:
Enter roles in comma separate format. [Admin,User]:
>Admin,User,Author
and press enter
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?
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_nameEdit:
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
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()
{
//
}
}