/** * @return void|Text */ protected function getModel() { try { return Text::findByCurrentSlug(); } catch (ModelNotFoundException $error) { } }
/** * Remove the specified resource from storage. * * @param string $slug * * @return \Illuminate\Http\Response */ public function destroy($slug) { $text = Text::findBySlug($slug); /** @var Model $model */ $model = $text->text; $model->destroy($model->id); $text->destroy($text->slug); return $this->redirectToIndex(); }