#1959 [cats] Toplu kategori silme

This commit is contained in:
Diatrex 2020-08-17 17:31:42 +03:00
parent 9a4e01ab58
commit b4e4049fdb
4 changed files with 37 additions and 2 deletions

View File

@ -0,0 +1,5 @@
<?php
return [
'categories_mass_delete_success' => 'Categories and related sub-categories has been deleted successfully!',
];

View File

@ -1,6 +1,7 @@
<?php namespace Visiosoft\CatsModule\Category\Table; <?php namespace Visiosoft\CatsModule\Category\Table;
use Anomaly\Streams\Platform\Ui\Table\TableBuilder; use Anomaly\Streams\Platform\Ui\Table\TableBuilder;
use Visiosoft\CatsModule\Category\Table\Handler\Delete;
class CategoryTableBuilder extends TableBuilder class CategoryTableBuilder extends TableBuilder
{ {
@ -68,6 +69,9 @@ class CategoryTableBuilder extends TableBuilder
* @var array|string * @var array|string
*/ */
protected $actions = [ protected $actions = [
'delete' => [
'handler' => Delete::class
]
]; ];
/** /**

View File

@ -0,0 +1,26 @@
<?php namespace Visiosoft\CatsModule\Category\Table\Handler;
use Anomaly\Streams\Platform\Ui\Table\Component\Action\ActionHandler;
use Visiosoft\CatsModule\Category\Contract\CategoryRepositoryInterface;
use Visiosoft\CatsModule\Category\Table\CategoryTableBuilder;
class Delete extends ActionHandler
{
public function handle(
CategoryTableBuilder $builder, array $selected,
CategoryRepositoryInterface $categoryRepository
)
{
try {
foreach ($selected as $id) {
$categoryRepository->DeleteCategories($id);
}
if ($selected) {
$this->messages->success(trans('visiosoft.module.cats::message.categories_mass_delete_success'));
}
} catch (\Exception $e) {
$this->messages->error($e->getMessage());
}
}
}

View File

@ -769,8 +769,8 @@ pre code {
.container-fluid { .container-fluid {
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
/*padding-left: 15px;*/ padding-left: 15px;
/*padding-right: 15px;*/ padding-right: 15px;
} }
.row { .row {