mirror of
https://github.com/openclassify/openclassify.git
synced 2026-02-28 00:24:41 -06:00
24 lines
461 B
PHP
24 lines
461 B
PHP
<?php namespace Visiosoft\AdvsModule\Adv\Command;
|
|
|
|
use Illuminate\Support\Str;
|
|
use Visiosoft\AdvsModule\Adv\Contract\AdvInterface;
|
|
|
|
class AddSlug
|
|
{
|
|
protected $ad;
|
|
|
|
public function __construct(AdvInterface $ad)
|
|
{
|
|
$this->ad = $ad;
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
if (!$this->ad->slug && $this->ad->name) {
|
|
$this->ad->update([
|
|
'slug' => Str::slug($this->ad->name)
|
|
]);
|
|
}
|
|
}
|
|
}
|