本文整理汇总了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', 'Время теста истекло');
}
}
}
示例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');
}
示例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);
}
}
示例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'));
}
示例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);
}
示例6: index
public static function index()
{
self::check_logged_in();
self::check_admin();
$groups = Group::all();
View::make('group/index.html', array('groups' => $groups));
}
示例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]);
}
示例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);
}
示例9: formSelect
public static function formSelect()
{
$result = array();
foreach (Group::all() as $group) {
$result[$group->id] = $group->name;
}
return $result;
}
示例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);
}
示例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);
}
示例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');
}
示例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));
}
示例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);
}
示例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');
}
}
}