public function destroy($condition_id) { $condition = Condition::findOrFail($condition_id); if (Gate::denies('delete-condition', $condition)) { abort(403); } $offer_id = $condition->offer->id; $condition->delete(); // Flash message Session::flash('message', 'You have deleted a condition from the offer.'); Session::flash('message-type', 'success'); // Redirect return redirect(url('/offer/' . $offer_id . '#conditions')); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $project = Project::findOrFail($id); $bookmark_id = "none"; if (Auth::check()) { $id_user = Auth::user()->id; $results = DB::select('select id from bookmarks where project_id = ? AND user_id = ?', [$project->id, $id_user]); if ($results) { $bookmark_id = $results; } } $data = ['pr' => Project::findOrFail($id), 'image' => $project->image()->get(), 'bookmark' => $bookmark_id, 'comments' => Comment::where('project_id', '=', $id)->get(), 'conditions' => Condition::findOrFail($id)]; // dd(Auth::user()->avatar); return view('project.info')->with($data); }