Beispiel #1
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($society, $yr, $id)
 {
     if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
         $data['soc'] = $society;
         $data['society'] = Society::where('society', '=', $society)->first();
         $data['goal'] = Goal::with(array('individual' => function ($query) {
             $query->wherePivot('deleted_at', null)->orderBy('surname', 'asc');
         }))->where('slug', '=', $id)->where('society_id', '=', $data['society']->id)->first();
         $data['contact'] = Individual::find($data['goal']->contact);
         $data['pagetitle'] = $data['goal']->groupname;
         $daysofweek = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday');
         $data['meeting'] = $daysofweek[-1 + $data['goal']->meeting];
         return View::make('goals.show', $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);
 }