add seo
This commit is contained in:
25
app/Console/Commands/FixSlug.php
Normal file
25
app/Console/Commands/FixSlug.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Shop\Article;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class FixSlug extends Command
|
||||
{
|
||||
protected $signature = 'FixSlug';
|
||||
|
||||
protected $description = 'Slugify articles';
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$articles = Article::all();
|
||||
foreach ($articles as $article) {
|
||||
$article->slug = null;
|
||||
$article->update(['name' => $article->name]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user