#3409 Arapça sorunu

This commit is contained in:
Diatrex 2021-02-23 16:17:04 +03:00
parent 713c2d5987
commit ac3f51194a
4 changed files with 34 additions and 3 deletions

View File

@ -1,5 +1,6 @@
<?php namespace Visiosoft\AdvsModule\Adv;
use Visiosoft\AdvsModule\Adv\Command\AddSlug;
use Visiosoft\AdvsModule\Adv\Command\DeleteOptionConfiguration;
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
use Anomaly\Streams\Platform\Entry\EntryObserver;
@ -8,6 +9,13 @@ use Visiosoft\AdvsModule\Adv\Event\DeletingAd;
class AdvObserver extends EntryObserver
{
public function updating(EntryInterface $entry)
{
$this->dispatch(new AddSlug($entry));
parent::updating($entry);
}
public function deleting(EntryInterface $entry)
{
$this->dispatch(new DeleteOptionConfiguration($entry));

View File

@ -0,0 +1,23 @@
<?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)
]);
}
}
}

View File

@ -63,7 +63,9 @@ class AdvFormBuilder extends FormBuilder
protected $rules = [];
protected $skips = [];
protected $skips = [
'slug'
];
protected $actions = [];

View File

@ -1,6 +1,5 @@
<?php namespace Visiosoft\AdvsModule\Http\Controller;
use Anomaly\FilesModule\File\Contract\FileRepositoryInterface;
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
use Anomaly\Streams\Platform\Http\Controller\PublicController;
use Anomaly\Streams\Platform\Message\MessageBag;
@ -11,7 +10,6 @@ use Illuminate\Contracts\Events\Dispatcher;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
use Illuminate\Support\Str;
use Visiosoft\AdvsModule\Adv\AdvModel;
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;