REFACTORING #1880 @1h: move content actions into interactions
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
namespace App\CMS\Interactions\Admin\Content;
|
||||
|
||||
use App\CMS\Contracts\Interaction;
|
||||
use App\CMS\Contracts\Repositories\Module;
|
||||
use App\Models\Content\Content;
|
||||
use Illuminate\Support\Facades\App;
|
||||
|
||||
class DeletePage implements Interaction
|
||||
{
|
||||
/**
|
||||
* Perform given action
|
||||
*
|
||||
* @param $data array input data
|
||||
* @param $parameters array parameters
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle($data, $parameters)
|
||||
{
|
||||
/**
|
||||
* @var $page Content
|
||||
* @var $module Module
|
||||
*/
|
||||
|
||||
$module = App::make(Module::class);
|
||||
list ($page) = $parameters;
|
||||
|
||||
// delete page
|
||||
$page->delete();
|
||||
|
||||
// let module to delete some extra content created during page's life
|
||||
$module->callOnString($page->moduleHandler, 'delete', [$page]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $data array input data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getValidationRules($data = [])
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user