Skip to content

Commit 9a9f199

Browse files
committed
bugfix for test cases
1 parent a43066a commit 9a9f199

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

database/migrations/create_custom_spatie_permission_table.php.stub

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ return new class extends Migration
2424
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
2525
}
2626

27+
Schema::dropIfExists($tableNames['permissions']);
2728
Schema::create($tableNames['permissions'], function (Blueprint $table) {
2829
//$table->engine('InnoDB');
2930
$table->bigIncrements('id'); // permission id
@@ -34,6 +35,7 @@ return new class extends Migration
3435
$table->unique(['name', 'guard_name']);
3536
});
3637

38+
Schema::dropIfExists($tableNames['roles']);
3739
Schema::create($tableNames['roles'], function (Blueprint $table) use ($teams, $columnNames) {
3840
//$table->engine('InnoDB');
3941
$table->bigIncrements('id'); // role id
@@ -51,6 +53,7 @@ return new class extends Migration
5153
}
5254
});
5355

56+
Schema::dropIfExists($tableNames['model_has_permissions']);
5457
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
5558
$table->unsignedBigInteger($pivotPermission);
5659

@@ -75,6 +78,7 @@ return new class extends Migration
7578

7679
});
7780

81+
Schema::dropIfExists($tableNames['model_has_roles']);
7882
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
7983
$table->unsignedBigInteger($pivotRole);
8084

@@ -98,6 +102,7 @@ return new class extends Migration
98102
}
99103
});
100104

105+
Schema::dropIfExists($tableNames['role_has_permissions']);
101106
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
102107
$table->unsignedBigInteger($pivotPermission);
103108
$table->unsignedBigInteger($pivotRole);

src/Models/Language.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ class Language extends BaseModel implements LanguageContract
1111
{
1212
protected $guarded = ['id'];
1313

14+
protected $casts = [
15+
'is_default' => 'boolean',
16+
];
17+
1418
public function contentRoutes()
1519
{
1620
return $this->hasMany(InspireCmsConfig::getContentRouteModelClass(), 'language_id');

src/Observers/ContentObserver.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,9 @@ public function forceDeleting($model)
107107

108108
$model->navigation()->delete();
109109

110+
$model->path()->delete();
111+
$model->routes()->delete();
112+
110113
$this->clearCached(); // Since the navigation is deleted, we need to clear the cache.
111114
}
112115

0 commit comments

Comments
 (0)