installation of Spatie / laravel-permission

0

Hi, I'm trying to install, spatie in lumen 5.6 I'm following the instructions in link

When trying to run the migrations I get the following error:

SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name '' (SQL: create table '' ('id' int unsigned not null a
  uto_increment primary key, 'name' varchar(255) not null, 'guard_name' varchar(255) not null, 'created_at' timestamp null, 'updated_
  at' timestamp null) default character set utf8mb4 collate utf8mb4_unicode_ci engine = InnoDB)

this is a summary of the migration

public function up()
{
    $tableNames = config('permission.table_names');

    Schema::create($tableNames['permissions'], function (Blueprint $table) {
      ......
    });

    Schema::create($tableNames['roles'], function (Blueprint $table) {
      ......
    });

    Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames) {
        .......
    });
}

My question is, what is the function of $tableNames ? I could already do the migrations leaving the code in the following way, removing all reference to $tableNames , I will not have problems later?

public function up ()     {

    Schema::create('permissions', function (Blueprint $table) {
      ......
    });

    Schema::create('roles', function (Blueprint $table) {
      ......
    });

    Schema::create('model_has_permissions', function (Blueprint $table){
        .......
    });
}
    
asked by gonzalezZ 01.03.2018 в 21:39
source

0 answers