| @@ 7-41 (lines=35) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateSpatiePermissionsTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | $tableNames = config('permission.table_names'); |
|
| 17 | ||
| 18 | Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
| 19 | $table->bigIncrements('id'); |
|
| 20 | $table->string('name'); |
|
| 21 | $table->string('guard_name'); |
|
| 22 | $table->timestamps(); |
|
| 23 | }); |
|
| 24 | ||
| 25 | app('cache') |
|
| 26 | ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
| 27 | ->forget(config('permission.cache.key')); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Reverse the migrations. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function down() |
|
| 36 | { |
|
| 37 | $tableNames = config('permission.table_names'); |
|
| 38 | ||
| 39 | Schema::drop($tableNames['permissions']); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||
| @@ 7-41 (lines=35) @@ | ||
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | use Illuminate\Database\Migrations\Migration; |
|
| 6 | ||
| 7 | class CreateSpatieRolesTable extends Migration |
|
| 8 | { |
|
| 9 | /** |
|
| 10 | * Run the migrations. |
|
| 11 | * |
|
| 12 | * @return void |
|
| 13 | */ |
|
| 14 | public function up() |
|
| 15 | { |
|
| 16 | $tableNames = config('permission.table_names'); |
|
| 17 | ||
| 18 | Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
| 19 | $table->bigIncrements('id'); |
|
| 20 | $table->string('name'); |
|
| 21 | $table->string('guard_name'); |
|
| 22 | $table->timestamps(); |
|
| 23 | }); |
|
| 24 | ||
| 25 | app('cache') |
|
| 26 | ->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null) |
|
| 27 | ->forget(config('permission.cache.key')); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Reverse the migrations. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function down() |
|
| 36 | { |
|
| 37 | $tableNames = config('permission.table_names'); |
|
| 38 | ||
| 39 | Schema::drop($tableNames['roles']); |
|
| 40 | } |
|
| 41 | } |
|
| 42 | ||