This commit is contained in:
shaiv-webkul 2020-02-07 15:48:20 +05:30
parent d43efc505a
commit f47f06de31
2 changed files with 8 additions and 7 deletions

View File

@ -139,9 +139,9 @@ return [
'datagrid' => [
'mass-ops' => [
'method-error' => 'Error! Wrong method detected, please check mass action configuration',
'delete-success' => 'System :resource were successfully deleted',
'delete-success' => 'Selected :resource were successfully deleted',
'partial-action' => 'Some actions were not performed due restricted system constraints on :resource',
'update-success' => 'System :resource were successfully updated',
'update-success' => 'Selected :resource were successfully updated',
'no-resource' => 'The resource provided for insufficient for the action'
],

View File

@ -153,7 +153,6 @@ class AttributeController extends Controller
public function massDestroy()
{
$suppressFlash = false;
if (request()->isMethod('post')) {
$indexes = explode(',', request()->input('indexes'));
@ -161,10 +160,12 @@ class AttributeController extends Controller
$attribute = $this->attributeRepository->find($value);
try {
if (! $attribute->is_user_defined) {
continue;
} else {
if ($attribute->is_user_defined) {
$suppressFlash = true;
$this->attributeRepository->delete($value);
} else {
session()->flash('error', trans('admin::app.response.user-define-error', ['name' => 'Attribute']));
}
} catch (\Exception $e) {
report($e);
@ -174,7 +175,7 @@ class AttributeController extends Controller
}
}
if (! $suppressFlash)
if ($suppressFlash)
session()->flash('success', trans('admin::app.datagrid.mass-ops.delete-success', ['resource' => 'attributes']));
else
session()->flash('info', trans('admin::app.datagrid.mass-ops.partial-action', ['resource' => 'attributes']));