public function getEnter(Request $request) { if (!session()->has('campaign_id')) { return redirect(route('pin')); } $campaign = Campaign::findOrFail(session()->get('campaign_id')); return view('entry.lead', compact('campaign')); }
/** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { // URL route is implicitly defined as the resource $campaign_id = $this->route('campaigns'); $campaign = Campaign::findOrFail($campaign_id); return $campaign->with('users')->whereHas('users', function ($q) { $q->where('user_id', Auth::id()); })->exists(); }
public function doDeleteCampaign($id) { $campaign = Campaign::findOrFail($id); $campaign->remove(); return redirect()->back()->with('campaign-deleted', true); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $campaigns = Campaigns::findOrFail($id); $campaigns->delete(); //Session::flash('flash_message', 'Campaign successfully deleted!'); return redirect('campaigns'); }
/** * Unarchive the campaign * * @param AdminShowRequest $request * @param Integer $id * @return Redirect */ public function putUnarchiveCampaign(AdminShowRequest $request, $id) { $campaign = Campaign::findOrFail($id); if (strtolower($request->get('title')) == strtolower($campaign->title)) { $campaign->active = 1; $campaign->save(); return redirect('campaigns/' . $campaign->id)->with('status', \Lang::get('campaign.unarchive.successful', ['title' => $campaign->title])); } else { return redirect('campaigns/' . $campaign->id . '/unarchive')->with('status', \Lang::get('campaign.unarchive.unsuccessful', ['title' => $campaign->title])); } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $campaign = Campaign::findOrFail($id); $campaign->delete(); return redirect('campaign'); }
public function getDelete($id) { $campaign = Campaign::findOrFail($id); return view('admin.campaigns.delete', compact('campaign')); }