public function destroyModel($model, $path = null)
    {
        $this->model = $model;
        try {
            if ( ! $this->model->delete()) {
                throw new DestroyException($this->model);
            }

            event(new $this->events['success']($this->model));

            if (is_null($path)) {
                return response()->json($this->returnData('success'));
            }
            Flash::success(trans('laravel-modules-base::admin.flash.destroy_success'));
            return $this->redirectRoute($path);
        } catch (DestroyException $e) {
            event(new $this->events['fail']($e->getDatas()));

            if (is_null($path)) {
                return response()->json($this->returnData('error'));
            }
            Flash::error(trans('laravel-modules-base::admin.flash.destroy_error'));
            return $this->redirectRoute($path);
        }
    }
public function destroyModel($model, $path = null)
    {
        $this->model = $model;
        try {
            if ( ! $this->model->delete()) {
                throw new DestroyException($this->model);
            }

            event(new $this->events['success']($this->model));

            if (is_null($path)) {
                return response()->json($this->returnData('success'));
            }
            Flash::success(trans('laravel-modules-base::admin.flash.destroy_success'));
            return $this->redirectRoute($path);
        } catch (DestroyException $e) {
            event(new $this->events['fail']($e->getDatas()));

            if (is_null($path)) {
                return response()->json($this->returnData('error'));
            }
            Flash::error(trans('laravel-modules-base::admin.flash.destroy_error'));
            return $this->redirectRoute($path);
        }
    }
public function destroyModel ( $ model , $ path = null ) { $ this -> model = $ model ; try { if ( ! $ this -> model -> delete ( ) ) { throw new DestroyException ( $ this -> model ) ; } event ( new $ this -> events [ 'success' ] ( $ this -> model ) ) ; if ( is_null ( $ path ) ) { return response ( ) -> json ( $ this -> returnData ( 'success' ) ) ; } Flash :: success ( trans ( 'laravel-modules-base::admin.flash.destroy_success' ) ) ; return $ this -> redirectRoute ( $ path ) ; } catch ( DestroyException $ e ) { event ( new $ this -> events [ 'fail' ] ( $ e -> getDatas ( ) ) ) ; if ( is_null ( $ path ) ) { return response ( ) -> json ( $ this -> returnData ( 'error' ) ) ; } Flash :: error ( trans ( 'laravel-modules-base::admin.flash.destroy_error' ) ) ; return $ this -> redirectRoute ( $ path ) ; } }
destroy data of the eloquent model or models

@param \Illuminate\Database\Eloquent\Model|array $model [Model|ids]
@param string|null $path
@return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
destroy data of the eloquent model or models