/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $requirement = Requirements::findOrFail($id); $project_id = $requirement->project_id; if ($requirement->user_id != $this->user['id']) { Session::flash('flash_message_warning', 'Sorry, you do not have enough privilege to make this change!'); return redirect("projects/{$project_id}"); } $requirement->delete(); Session::flash('flash_message', 'Requirement successfully deleted!'); return redirect("projects/{$project_id}"); }