コード例 #1
0
 /**
  * View the committee.
  * @return Response
  */
 public function view()
 {
     $roles = CommitteeRole::orderBy('order', 'ASC')->get();
     $order = ['1' => 'At the beginning'];
     foreach ($roles as $role) {
         $order[$role->order + 1] = "After '{$role->name}'";
     }
     return View::make('committee.view')->with(['roles' => $roles, 'order' => $order]);
 }
コード例 #2
0
 /**
  * Determine the positions available in an election.
  * @param \App\Http\Requests\ElectionRequest $request
  * @return array
  */
 private function determineElectionPositions(ElectionRequest $request)
 {
     if ($request->get('type') == 2) {
         $positions_checked = $request->get('positions_checked');
         $positions = array_values(array_filter($request->get('positions'), function ($index) use($positions_checked) {
             return in_array($index, $positions_checked);
         }, ARRAY_FILTER_USE_KEY));
     } else {
         $positions = CommitteeRole::orderBy('order', 'ASC')->lists('name', 'id')->toArray();
     }
     return $positions;
 }