public function delete($id)
    {
        $builder = ModuleRow::withoutGlobalScopes();
        if (auth()->user()->hasRoles('member')) {
            $builder->where(['user_id' => auth()->user()->id]);
        }
        $model = $builder->findOrFail($id);
        $name  = $model->name;
        if ($model->delete()) {
            event('notifications.item_has_been_deleted', ['variables' => ['user' => user(), 'item' => $model]]);
            return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.item_has_been_deleted', ['name' => $name]), 'success');
        }
        event('notifications.item_has_not_been_deleted', ['variables' => ['user' => user(), 'item' => $model]]);
        return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.item_has_not_been_deleted', ['name' => $name]), 'error');
    }
public function delete($id)
    {
        $builder = ModuleRow::withoutGlobalScopes();
        if (auth()->user()->hasRoles('member')) {
            $builder->where(['user_id' => auth()->user()->id]);
        }
        $model = $builder->findOrFail($id);
        $name  = $model->name;
        if ($model->delete()) {
            event('notifications.item_has_been_deleted', ['variables' => ['user' => user(), 'item' => $model]]);
            return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.item_has_been_deleted', ['name' => $name]), 'success');
        }
        event('notifications.item_has_not_been_deleted', ['variables' => ['user' => user(), 'item' => $model]]);
        return redirect_with_message(handles('antares::sample_module/index'), trans('antares/sample_module::messages.item_has_not_been_deleted', ['name' => $name]), 'error');
    }
public function delete ( $ id ) { $ builder = ModuleRow :: withoutGlobalScopes ( ) ; if ( auth ( ) -> user ( ) -> hasRoles ( 'member' ) ) { $ builder -> where ( [ 'user_id' => auth ( ) -> user ( ) -> id ] ) ; } $ model = $ builder -> findOrFail ( $ id ) ; $ name = $ model -> name ; if ( $ model -> delete ( ) ) { event ( 'notifications.item_has_been_deleted' , [ 'variables' => [ 'user' => user ( ) , 'item' => $ model ] ] ) ; return redirect_with_message ( handles ( 'antares::sample_module/index' ) , trans ( 'antares/sample_module::messages.item_has_been_deleted' , [ 'name' => $ name ] ) , 'success' ) ; } event ( 'notifications.item_has_not_been_deleted' , [ 'variables' => [ 'user' => user ( ) , 'item' => $ model ] ] ) ; return redirect_with_message ( handles ( 'antares::sample_module/index' ) , trans ( 'antares/sample_module::messages.item_has_not_been_deleted' , [ 'name' => $ name ] ) , 'error' ) ; }
When deletes item

@param mixed $id
@return \Illuminate\Http\RedirectResponse
When deletes item