fix migration for mairet dev
This commit is contained in:
parent
74f88ffc0e
commit
2ebcf417c0
1 changed files with 7 additions and 0 deletions
|
|
@ -50,6 +50,13 @@ class ChangeContentsTable extends Migration
|
|||
$page->slug = Str::slug($page->title ?? $page->value);
|
||||
$page->saveQuietly();
|
||||
});
|
||||
$pages = StaticPage::all();
|
||||
$pages->each(function (StaticPage $page) use ($pages) {
|
||||
if ($pages->where('slug', $page->slug)->count() > 1) {
|
||||
$page->slug = "{$page->slug}2";
|
||||
}
|
||||
$page->saveQuietly();
|
||||
});
|
||||
Schema::table('static_pages', function (Blueprint $table) {
|
||||
$table->unique('slug');
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue