You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownew \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
22
-
}
23
-
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
24
-
thrownew \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
25
-
}
26
-
27
-
Schema::create($tableNames['permissions'], function (Blueprint$table) {
28
-
$table->bigIncrements('id'); // permission id
29
-
$table->string('name'); // For MySQL 8.0 use string('name', 125);
30
-
$table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125);
20
+
throw_if(empty($tableNames), 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
21
+
throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
22
+
23
+
/**
24
+
* See `docs/prerequisites.md` for suggested lengths on 'name' and 'guard_name' if "1071 Specified key was too long" errors are encountered.
@@ -132,14 +133,12 @@ public function down(): void
132
133
{
133
134
$tableNames = config('permission.table_names');
134
135
135
-
if (empty($tableNames)) {
136
-
thrownew \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
137
-
}
136
+
throw_if(empty($tableNames), 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
Copy file name to clipboardExpand all lines: database/migrations/2024_03_06_181814_add_teams_fields.php
+12-14Lines changed: 12 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
<?php
2
2
3
+
useIlluminate\Database\Migrations\Migration;
4
+
useIlluminate\Database\Schema\Blueprint;
3
5
useIlluminate\Support\Facades\DB;
4
6
useIlluminate\Support\Facades\Schema;
5
-
useIlluminate\Database\Schema\Blueprint;
6
-
useIlluminate\Database\Migrations\Migration;
7
7
8
8
returnnewclassextends Migration
9
9
{
@@ -21,12 +21,9 @@ public function up(): void
21
21
if (! $teams) {
22
22
return;
23
23
}
24
-
if (empty($tableNames)) {
25
-
thrownew \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
26
-
}
27
-
if (empty($columnNames['team_foreign_key'] ?? null)) {
28
-
thrownew \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
29
-
}
24
+
25
+
throw_if(empty($tableNames), 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
26
+
throw_if(empty($columnNames['team_foreign_key'] ?? null), 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
30
27
31
28
if (! Schema::hasColumn($tableNames['roles'], $columnNames['team_foreign_key'])) {
32
29
Schema::table($tableNames['roles'], function (Blueprint$table) use ($columnNames) {
0 commit comments