当前位置: 首页>>代码示例>>PHP>>正文


PHP Group::all方法代码示例

本文整理汇总了PHP中Group::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::all方法的具体用法?PHP Group::all怎么用?PHP Group::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: startIndexAction

 /**
  * Start test
  */
 public function startIndexAction()
 {
     Assets::reset()->add('main');
     $token = $this->getToken();
     if (!$token) {
         return Redirect::route('info')->with('message', 'Токен не найден');
     }
     if ($token->status == Token::TOKEN_STATUS_EMPTY) {
         /**
          * вывести форму где пользователь введёт свои данные
          */
         $departments = Department::all();
         $groups = Group::all();
         $selectedDepartments = array();
         $selectGroups = array();
         $selectedDepartments[] = 'Не выбран';
         $selectGroups[] = 'Не выбран';
         foreach ($departments as $department) {
             $selectedDepartments[$department->id] = $department->name;
         }
         foreach ($groups as $group) {
             $selectGroups[$group->id] = $group->name;
         }
         return View::make('test.start', ['token' => $token, 'departments' => $selectedDepartments, 'groups' => $selectGroups]);
     } elseif ($token->status == Token::TOKEN_STATUS_STARTED) {
         if ($this->isTokenValid($token)) {
             return Redirect::route('test.index');
         } else {
             Session::forget('token_string');
             $token->status = Token::TOKEN_STATUS_EXPIRED;
             $token->save();
             return Redirect::route('info')->with('message', 'Время теста истекло');
         }
     }
 }
开发者ID:himor,项目名称:testing,代码行数:38,代码来源:TokenController.php

示例2: fire

 /**
  * Execute the console command.
  *
  * @return void
  */
 public function fire()
 {
     $x = 1;
     foreach (Group::all() as $group) {
         $contents = Content::where('group_id', $group->getKey())->count();
         $entries = Entry::where('group_id', $group->getKey())->count();
         $total = $contents + $entries;
         // Default activity is medium = 2
         $group->activity = 2;
         // Low activity, when nothing was added last week
         if ($total == 0) {
             $group->activity = 1;
         }
         if ($total > 15) {
             $group->activity = 3;
         }
         if ($total > 50) {
             $group->activity = 4;
         }
         $group->save();
         if (!($x % 100)) {
             $this->info($x . ' groups processed');
         }
         $x++;
     }
     $this->info('All groups processed');
 }
开发者ID:vegax87,项目名称:Strimoid,代码行数:32,代码来源:GroupActivity.php

示例3: post_login

 public function post_login()
 {
     $credentials = array('email' => Input::get('username'), 'password' => Input::get('password'));
     $remember = Input::has('remember') ? true : false;
     $rules = array('email' => array('required', 'min:2'), 'password' => array('required', 'min:6'));
     $messages = array('email.required' => 'È necessario specificare il proprio username e la propria password per accedere', 'email.min' => 'Lo username deve essere lungo almeno 2 caratteri', 'password.required' => 'È necessario specificare il proprio username e la propria password per accedere', 'password.min' => 'La password deve essere lunga almeno 6 caratteri');
     $validator = Validator::make($credentials, $rules, $messages);
     if ($validator->passes()) {
         try {
             $user = Sentry::findUserByCredentials($credentials);
             $groups = Group::all();
             if ($user) {
                 foreach ($groups as $group) {
                     if ($user->inGroup($group->name)) {
                         $userAuth = Sentry::authenticate($credentials, $remember);
                         if ($userAuth) {
                             return $this->make_response($credentials, false, array($user->first_name . ' ' . $user->first_last . ', Accesso ' . $group->name . ' consentito'), URL::to('admin/dashboard'));
                         }
                     }
                 }
             }
         } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
             return $this->make_response($credentials, true, array('Non hai inserito la password'));
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return $this->make_response($credentials, true, array('Utente non trovato'));
         } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
             return $this->make_response($credentials, true, array('Password o nome utente non corretti'));
         } catch (\Exception $e) {
             return $this->make_response($credentials, true, array("errore non previsto: " . $e->getMessage()));
         }
     } else {
         $errors = $validator->messages;
         return $this->make_response($credentials, true, $errors);
     }
 }
开发者ID:lucabro81,项目名称:edutube,代码行数:35,代码来源:LoginController.php

示例4: getEdit

 public function getEdit($id)
 {
     Allow::permission($this->module['group'], 'groups');
     if ($id == 1 && !Allow::superuser()) {
         Redirect(link::auth($this->module['rest']));
     }
     $groups = Group::all();
     $group = Group::find($id);
     $mod_actions = Config::get('mod_actions');
     $mod_info = Config::get('mod_info');
     #Helper::dd($mod_actions);
     #Helper::dd($mod_info);
     $group_actions = Action::where('group_id', $group->id)->get();
     #$actions = $group->actions();
     $actions = array();
     foreach ($group_actions as $action) {
         #Helper::d($action->status);
         #continue;
         if ($action->status) {
             $actions[$action->module][$action->action] = $action->status;
         }
     }
     #Helper::dd($actions);
     $group_actions = $actions;
     return View::make($this->module['tpl'] . 'edit', compact('groups', 'group', 'mod_actions', 'mod_info', 'group_actions'));
 }
开发者ID:Grapheme,项目名称:doktornarabote,代码行数:26,代码来源:admin_groups.controller.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     //get all the groups
     $groups = Group::all();
     //load the view make and pass the groups
     return View::make('groups.index')->with('groups', $groups);
 }
开发者ID:elaine92,项目名称:crud_operations,代码行数:12,代码来源:GroupController.php

示例6: index

 public static function index()
 {
     self::check_logged_in();
     self::check_admin();
     $groups = Group::all();
     View::make('group/index.html', array('groups' => $groups));
 }
开发者ID:Hecarrah,项目名称:Tsoha-Bootstrap,代码行数:7,代码来源:groupController.php

示例7: add_info

 public function add_info()
 {
     $groups = Group::all();
     $students = Student::all();
     $disps = Disp::all();
     return view('students.add-info', ['groups' => $groups, 'students' => $students, 'disps' => $disps]);
 }
开发者ID:steverovsky,项目名称:cycle-store,代码行数:7,代码来源:StudentsMarks.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($schoolName, $surveyName)
 {
     $school = School::where('name', '=', $schoolName)->first();
     if (!$school) {
         return Redirect::to('/schools/');
     }
     $survey = Survey::where('name', '=', $surveyName)->first();
     if (!$survey) {
         return Redirect::to("/schools/{$schoolName}");
     }
     $groupStats = array();
     foreach (Group::all() as $group) {
         $possibleLink = $group->surveys()->where('survey_id', $survey->id)->first();
         $active = !is_null($possibleLink);
         $groupInfo = array('group' => $group, 'open_time' => 'no time set', 'close_time' => 'no time set');
         if ($active) {
             $active = strtotime($possibleLink->pivot->open_time) < time() && strtotime($possibleLink->pivot->close_time) > time();
             if (strtotime($possibleLink->pivot->open_time)) {
                 $groupInfo['open_time'] = $possibleLink->pivot->open_time;
             }
             if (strtotime($possibleLink->pivot->close_time)) {
                 $groupInfo['close_time'] = $possibleLink->pivot->close_time;
             }
         }
         $groupInfo['active'] = $active;
         array_push($groupStats, $groupInfo);
     }
     return View::make('content.surveyShow')->with('school', $school)->with('survey', $survey)->with('groupStats', $groupStats);
 }
开发者ID:AlexLeung,项目名称:ibsurvey,代码行数:35,代码来源:SurveysController.php

示例9: formSelect

 public static function formSelect()
 {
     $result = array();
     foreach (Group::all() as $group) {
         $result[$group->id] = $group->name;
     }
     return $result;
 }
开发者ID:hlmasterchief,项目名称:lacrestaurant,代码行数:8,代码来源:Group.php

示例10: getHome

 public function getHome()
 {
     $events = Myevent::all();
     $groups = Group::all();
     $subgroups = Subgroup::all();
     $users = User::all();
     return View::make('home')->with('events', $events)->with('groups', $groups)->with('subgroups', $subgroups)->with('users', $users);
 }
开发者ID:kjlegacy,项目名称:UserGroupEvents,代码行数:8,代码来源:HomeController.php

示例11: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     // Show a listing of groups.
     $employeeId = Session::get('userEmployeeId');
     $employee = new Employee();
     $employeeInfo = $employee->getEmployeeInfoById($employeeId);
     $groups = Group::all();
     return View::make('admin.indexgroup')->with('groups', $groups)->with('employeeInfo', $employeeInfo);
 }
开发者ID:jarciga,项目名称:Euler2015Alpha,代码行数:14,代码来源:GroupController.php

示例12: home

 /**
  * This is the publicly viewable page, a group of works
  * identified by the group id
  *
  * @param $id The id of the group requested
  * @return mixed
  *
  */
 public function home()
 {
     // get the groups
     $groups = Group::all();
     $texts = Text::all();
     $body_class = 'top-photo';
     // show the view and pass the group to it
     return View::make('pages.home')->with('groups', $groups)->with('texts', $texts)->with('body_class', $body_class)->with('title', 'Sharon Hall');
 }
开发者ID:duncanssmith,项目名称:shn,代码行数:17,代码来源:PagesController.php

示例13: groups

 public static function groups()
 {
     self::checkLoggedIn();
     $user = self::getUserLoggedIn();
     if ($user->admin) {
         $groups = Group::all();
     } else {
         $groups = Group_Member::findGroupByUserId($user->id);
     }
     View::make('groups.html', array('groups' => $groups));
 }
开发者ID:glvv,项目名称:Keskustelufoorumi,代码行数:11,代码来源:forum_controller.php

示例14: getVerify

 public function getVerify()
 {
     $this->beforeFilter('admin');
     $status = Input::get('status');
     if ($status) {
         $groups = Group::where('status', '=', $status)->get();
     } else {
         $groups = Group::all();
     }
     return Response::json($groups);
 }
开发者ID:krues8dr,项目名称:madison,代码行数:11,代码来源:GroupsApiController.php

示例15: showDice

 public function showDice($groupid = 0)
 {
     /**
      * Steps Involved:
      * 1. Check if the user has more than one group
      * 2. IF the user is a part of more than one group then display the
      * group list or else display the dice
      */
     /**
      * Get the current user
      */
     $user = Auth::user();
     /**
      * Execute if we are looking for a specific group
      */
     if (!empty($groupid)) {
         // TODO: either the user should be admin or should be a part of
         // this group
         if (!($group = Group::find($groupid))) {
             App::abort(404);
         }
         /**
          * Check if the user can view the group/post in it
          */
         if (!$user->hasGroup($groupid) && !$user->hasRole('admin')) {
             App::abort(404);
         }
         // Check if the user has a pending task
         if ($pendingTask = DB::table('user_tasks')->where('user_id', $user->id)->where('group_id', $group->id)->where('complete', 0)->get()) {
             return Redirect::action('PlayController@showStatusPage', array('id' => $group->id))->with('task', $pendingTask);
         }
         return Redirect::action('PlayController@showStatusPage', array('id' => $group->id))->with('task', $pendingTask);
         // TODO: pass the group id as well...This will help us fetch the
         // latest task
     } else {
         if ($user->getGroupCount() > 1 || $user->hasRole('admin')) {
             // TODO: Also check if the user can view all the groups
             if ($user->hasRole('admin')) {
                 $groups = Group::all();
             } else {
                 $groups = $user->getGroups();
             }
             $this->layout->content = View::make('play.groups')->with('groups', $groups)->with('user', $user);
         } elseif ($user->getGroupCount() == 1) {
             $group = $user->getGroups()->first();
             return Redirect::action('PlayController@showStatusPage', array('id' => $group->id));
         } elseif ($user->getGroupCount() == 0) {
             // TODO: tell the user that there are no groups and he/she needs
             //  to be part of atleast one group
             $this->layout->content = View::make('play.nogroup');
         }
     }
 }
开发者ID:RHoKAustralia,项目名称:onaroll21_backend,代码行数:53,代码来源:PlayController.php


注:本文中的Group::all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。