forked from eatvio/eatvio-infra
Merge pull request 'main' (#38) from apoloz/eatvio:main into main
Reviewed-on: eatvio/eatvio#38
This commit is contained in:
45
app/Console/Commands/UpdateSlugs.php
Normal file
45
app/Console/Commands/UpdateSlugs.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Recipe;
|
||||
|
||||
class UpdateSlugs extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'app:update-slugs';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'update entities slugs';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
Recipe::where('slug', '')
|
||||
->get()
|
||||
->each(
|
||||
function ($model) {
|
||||
$newName = $model->title . " 2612";
|
||||
$oldName = Str::replaceLast(' 2612', '', $newName);
|
||||
|
||||
$model->title = $newName;
|
||||
$model->save();
|
||||
|
||||
$model->title = $oldName;
|
||||
$model->save();
|
||||
}
|
||||
);
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
|
||||
<p class="announcement__desc">
|
||||
{{ $plan->details }}
|
||||
{!! $plan->details !!}
|
||||
</p>
|
||||
|
||||
@php
|
||||
|
||||
Reference in New Issue
Block a user