/** * Display a listing of the resource. * * @return Response */ public function index($society, $yr) { if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) { $data['soc'] = Society::find($society); $data['yr'] = $yr; $data['goals'] = Goal::where('society_id', '=', $society)->where('goalyear', '=', $yr)->orderBy('goal')->get(); return View::make('goals.index', $data); } else { return View::make("shared.unauthorised"); } }
public function vision($society) { $data['soc'] = $society; $data['society'] = Society::where('society', '=', $society)->first(); $data['goals'] = Goal::where('society_id', '=', $data['society']->id)->where('goalyear', '=', date("Y"))->get(); $others = Goal::with('society')->where('society_id', '<>', $data['society']->id)->where('goalyear', '=', date("Y"))->get(); $data['others'] = array(); foreach ($others as $other) { $data['others'][$other->society->society][] = $other->goal; } return view('societies.vision', $data); }