/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { //TODO check if user is admin if (\Auth::user()->isUserAdmin()) { $snippet = Snippet::where('id', $id)->orWhere('slug', $id)->firstOrFail(); File::deleteDirectory($snippet->path_to_material); $snippet->delete(); return redirect('/snippets'); } }