/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $campaign = \Session::get('campaign'); $campaign->fillRelations(); foreach ($campaign->getRelations() as $relation) { foreach ($relation as $title => $components) { //Split it out into human readable terms $pieces = explode('\\', $title); $title_component = $pieces[count($pieces) - 1]; $data['objects'][$title_component] = $components; } } $data['campaigns'] = CampaignMembership::where('user_id', \Auth::user()->id)->get(); foreach ($data['campaigns'] as $campaign) { $campaign->details; } $data['object_count'] = count($data['objects']); $data['columns'] = 5; $data['logs'] = QuestLog::where('campaign_id', \Session::get('campaign')->id)->orderBy('id', 'desc')->get(); //Let's remove restricted content for non dms foreach ($data['logs'] as $key => $value) { foreach ($value as $component) { if ($value->restricted == 1 && \Session::get('dm') == 0) { unset($data['logs'][$key]); } } } return view('dashboards.index')->with($data); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $ql = QuestLog::find($id); $ql->delete(); return redirect(\URL::to('/')); }