mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
created deleted and deleting event
This commit is contained in:
parent
8ec0b7ba9c
commit
0d791492d7
@ -3,6 +3,8 @@
|
||||
use Visiosoft\AdvsModule\Adv\Command\DeleteOptionConfiguration;
|
||||
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||
use Anomaly\Streams\Platform\Entry\EntryObserver;
|
||||
use Visiosoft\AdvsModule\Adv\Event\DeletedAd;
|
||||
use Visiosoft\AdvsModule\Adv\Event\DeletingAd;
|
||||
|
||||
class AdvObserver extends EntryObserver
|
||||
{
|
||||
@ -10,6 +12,14 @@ class AdvObserver extends EntryObserver
|
||||
{
|
||||
$this->dispatch(new DeleteOptionConfiguration($entry));
|
||||
|
||||
event(new DeletingAd($entry));
|
||||
|
||||
parent::deleting($entry);
|
||||
}
|
||||
|
||||
public function deleted(EntryInterface $entry)
|
||||
{
|
||||
event(new DeletedAd($entry));
|
||||
parent::deleted($entry);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,17 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Event;
|
||||
|
||||
|
||||
class DeletedAd
|
||||
{
|
||||
protected $entry;
|
||||
|
||||
public function __construct($entry)
|
||||
{
|
||||
$this->entry = $entry;
|
||||
}
|
||||
|
||||
public function getEntry()
|
||||
{
|
||||
return $this->entry;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
<?php namespace Visiosoft\AdvsModule\Adv\Event;
|
||||
|
||||
|
||||
class DeletingAd
|
||||
{
|
||||
protected $entry;
|
||||
|
||||
public function __construct($entry)
|
||||
{
|
||||
$this->entry = $entry;
|
||||
}
|
||||
|
||||
public function getEntry()
|
||||
{
|
||||
return $this->entry;
|
||||
}
|
||||
}
|
||||
@ -662,8 +662,8 @@ class AdvsController extends PublicController
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.delete_author_error'));
|
||||
}
|
||||
|
||||
$advs->softDeleteAdv($id);
|
||||
$this->messages->error(trans('visiosoft.module.advs::message.success_delete'));
|
||||
$ad->delete();
|
||||
$this->messages->success(trans('visiosoft.module.advs::message.success_delete'));
|
||||
return back();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user