本文整理汇总了PHP中app\models\Group::whereIn方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::whereIn方法的具体用法?PHP Group::whereIn怎么用?PHP Group::whereIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Group
的用法示例。
在下文中一共展示了Group::whereIn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCreate
/**
* Returns a view that displays the user creation form.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return View
*/
public function getCreate()
{
$groups = Group::pluck('name', 'id');
if (Input::old('groups')) {
$userGroups = Group::whereIn('id', Input::old('groups'))->pluck('name', 'id');
} else {
$userGroups = collect();
}
$permissions = config('permissions');
$userPermissions = Helper::selectedPermissionsArray($permissions, Input::old('permissions', array()));
$location_list = Helper::locationsList();
$manager_list = Helper::managerList();
$company_list = Helper::companyList();
return View::make('users/edit', compact('groups', 'userGroups', 'permissions', 'userPermissions'))->with('location_list', $location_list)->with('manager_list', $manager_list)->with('company_list', $company_list)->with('user', new User());
}
示例2: details
public function details($society, $id, $year, $month)
{
if (Helpers::perm('admin', $society) or Helpers::perm('edit', $society)) {
$data['society'] = $society;
$data['roster'] = Roster::with('group')->find($id);
$extrainfo = explode(",", $data['roster']->extrainfo);
$data['extragroups'] = Group::whereIn('id', $extrainfo)->get();
$data['multigroups'] = explode(",", $data['roster']->multichoice);
$subcat = explode(",", $data['roster']->subcategories);
if ($subcat[0] != "") {
$subcat[] = "#!@";
foreach ($data['roster']->group as $thisgroup) {
$shortened = false;
foreach ($subcat as $thisubcat) {
if (strpos($thisgroup->groupname, $thisubcat)) {
$key = trim(str_replace($thisubcat, "", $thisgroup->groupname));
$shortgroups[$key][$thisubcat] = $thisgroup->id;
$shortened = true;
}
}
if (!$shortened) {
$key = trim($thisgroup->groupname);
$shortgroups["_" . $key]['#!@'] = $thisgroup->id;
}
}
} else {
foreach ($data['roster']->group as $thisgroup) {
$shortgroups[$thisgroup->groupname]['#!@'] = $thisgroup->id;
}
$subcat[0] = "#!@";
}
ksort($shortgroups);
$firstinmonth = $data['roster']->dayofweek - date_format(date_create($year . "-" . $month . '-01'), 'N') + 1;
if ($firstinmonth > 7) {
$firstinmonth = $firstinmonth - 7;
} elseif ($firstinmonth < 1) {
$firstinmonth = $firstinmonth + 7;
}
$dates[] = date_format(date_create($year . "-" . $month . '-' . $firstinmonth), 'Y-m-d');
for ($i = 1; $i < 5; $i++) {
$testdate = strtotime('+1 week', strtotime($dates[$i - 1]));
if (date("m", $testdate) == $month) {
$dates[] = date("Y-m-d", $testdate);
} else {
break;
}
}
$selnum = array('1', '2');
foreach ($dates as $tdate) {
foreach ($shortgroups as $skey => $sgrp) {
foreach ($subcat as $thiscat) {
foreach ($selnum as $seln) {
if (array_key_exists($thiscat, $sgrp)) {
$individ = DB::table('group_individual_roster')->where('rosterdate', '=', $tdate)->where('roster_id', '=', $id)->where('group_id', '=', $sgrp[$thiscat])->where('selection', '=', $seln)->get();
$data['weeks'][$tdate][$thiscat][$skey][$seln]['group_id'] = $sgrp[$thiscat];
if (isset($individ[0]->individual_id)) {
$data['weeks'][$tdate][$thiscat][$skey][$seln]['individual_id'] = $individ[0]->individual_id;
}
}
}
}
}
}
$data['groupheadings'] = array_keys($shortgroups);
$data['rosterdetails'] = Roster::with('rosterdetails_group', 'rosterdetails_individual')->find($id);
foreach ($data['roster']->group as $grp) {
$data['groupmembers'][$grp->id][0] = "";
foreach ($grp->individual as $ind) {
$data['groupmembers'][$grp->id][$ind->id] = $ind->firstname . " " . $ind->surname;
}
}
$data['rosteryear'] = $year;
$data['socname'] = Society::find($society)->society;
$data['rostermonth'] = $month;
$data['months'] = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
return View::make('rosters.details', $data);
} else {
return view('shared.unauthorised');
}
}