本文整理汇总了PHP中app\Group::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::where方法的具体用法?PHP Group::where怎么用?PHP Group::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\Group
的用法示例。
在下文中一共展示了Group::where方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the job.
*
* @return void
*/
public function handle(Mailer $mail)
{
$group = $this->ticket->group_id;
$customers = Group::where('id', $group)->first()->customers()->get();
$_customers = [];
foreach ($customers as $customer) {
$_customers[] = $customer->id;
}
$sys_name = Settings::where('name', 'sys_name')->first();
$user = User::whereIn('customer_id', $_customers)->get();
foreach ($user as $_user) {
$mail->send('emails.updateticket', ['user' => $_user, 'ticket' => $this->ticket, 'response' => $this->response, 'sys_name' => $sys_name], function ($m) use($_user) {
$m->to($_user->email, $_user->first_name . ' ' . $_user->last_name)->subject('Ticket updated - ' . $this->ticket->track_id . ' [' . $this->ticket->status->name . ']');
if (count($this->response->attachments()->get()) > 0) {
foreach ($this->response->attachments as $attachment) {
$m->attach(storage_path() . '/attachments/' . $this->ticket->id . '/' . $attachment->name);
}
}
});
}
// Cleanup variables
unset($this->ticket);
unset($this->response);
unset($group);
unset($customers);
unset($user);
unset($sys_name);
unset($_customers);
}
示例2: groupsForUser
/**
* @param null $user
* @param int $howMany
* @return mixed
*/
public function groupsForUser($user = null, $howMany = 1)
{
if ($user != null) {
return Group::where('user_id', $user->id)->simplePaginate($howMany);
}
return Group::where('user_id', $this->user()->id)->simplePaginate($howMany);
}
示例3: getSeries
public function getSeries($slug)
{
$group = Group::where('slug', 'like', $slug)->first();
if (is_null($group)) {
return false;
}
return $group->toArray();
}
示例4: buildGroupUsersCountStatistic
/**
* @return string
*/
public static function buildGroupUsersCountStatistic()
{
$groups = Group::where('name', '!=', 'admin_group')->get();
$data = array();
foreach ($groups as $k => $group) {
$data[$k]['group'] = $group->name;
$data[$k]['staffCount'] = count($group->users);
}
return json_encode($data);
}
示例5: pagination
public static function pagination($id)
{
$data = Group::where('challenge_id', '=', $id)->get()->toArray();
for ($i = 0; $i <= count($data) - 1; $i++) {
$dr = Groupsta::where('group_id', '=', $data[$i]['id'])->join('rb_rounds', 'rb_rounds.id', '=', 'rb_group_stage.round_id')->join('rb_team', 'rb_team.id', '=', 'rb_rounds.team_id')->select('rb_rounds.*', 'rb_team.name as nombre_equipo', 'rb_team.name_altered as nombre_alterno', 'rb_team.gender as genero', 'rb_group_stage.id as id_g_s')->get()->toArray();
$data[$i]['data_team'] = [];
$data[$i]['data_team'] += $dr;
}
return $data;
}
示例6: postSearch
/**
* Show the application dashboard to the user.
*
* @return Response
*/
public function postSearch()
{
$query_term = \Request::input('search-term');
error_log('Search ' . json_encode($query_term));
//filter types
$users = \App\User::where('last_name', 'LIKE', "%{$query_term}%")->get();
$groups = \App\Group::where('name', 'LIKE', "%{$query_term}%")->get();
error_log('>>> Le search users' . json_encode($groups));
$bodyclass = "app-search";
return view('site.search.index', compact('bodyclass', 'users', 'groups'));
}
示例7: compose
/**
* Generates the group listing for the view.
*
* @param \Illuminate\Contracts\View\View $view
* @return void
*/
public function compose(View $view)
{
$active_group = null;
$active_project = null;
if (isset($view->project) && !$view->project->is_template) {
$active_group = $view->project->group_id;
$active_project = $view->project->id;
}
$groups = Group::where('id', '<>', Template::GROUP_ID)->orderBy('name')->get();
$view->with('active_group', $active_group);
$view->with('active_project', $active_project);
$view->with('groups', $groups);
}
示例8: index
public function index(Request $request)
{
if ($request->has('query')) {
$query = $request->get('query');
// build a list of public groups and groups the user has access to
$my_groups = Auth::user()->groups()->orderBy('name')->get();
$my_groups_id = [];
// using this array we can adjust the queries after to only include stuff the user has
// might be a good idea to find a clever way to build this array of groups id :
foreach ($my_groups as $the_group) {
$my_groups_id[$the_group->id] = $the_group->id;
}
$public_groups = \App\Group::where('group_type', \App\Group::OPEN)->get();
$public_groups_id = [];
// using this array we can adjust the queries after to only include stuff the user has
// might be a good idea to find a clever way to build this array of groups id :
foreach ($public_groups as $the_group) {
$public_groups_id[$the_group->id] = $the_group->id;
}
$allowed_groups = array_merge($my_groups_id, $public_groups_id);
$groups = \App\Group::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->orderBy('name')->get();
$users = \App\User::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->orderBy('name')->with('groups')->get();
$discussions = \App\Discussion::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->whereIn('group_id', $allowed_groups)->orderBy('updated_at', 'desc')->with('group')->get();
$actions = \App\Action::where('name', 'like', '%' . $query . '%')->orWhere('body', 'like', '%' . $query . '%')->whereIn('group_id', $allowed_groups)->with('group')->orderBy('updated_at', 'desc')->get();
$files = \App\File::where('name', 'like', '%' . $query . '%')->whereIn('group_id', $allowed_groups)->with('group')->orderBy('updated_at', 'desc')->get();
$comments = \App\Comment::where('body', 'like', '%' . $query . '%')->with('discussion.group')->orderBy('updated_at', 'desc')->get();
// set in advance which tab will be active on the search results page
$groups->class = '';
$discussions->class = '';
$actions->class = '';
$users->class = '';
$comments->class = '';
$files->class = '';
// the order of those ifs should match the order of the tabs on the results view :-)
if ($groups->count() > 0) {
$groups->class = 'active';
} elseif ($discussions->count() > 0) {
$discussions->class = 'active';
} elseif ($actions->count() > 0) {
$action->class = 'active';
} elseif ($users->count() > 0) {
$users->class = 'active';
} elseif ($comments->count() > 0) {
$comments->class = 'active';
} elseif ($files->count() > 0) {
$files->class = 'active';
}
return view('search.results')->with('groups', $groups)->with('users', $users)->with('discussions', $discussions)->with('files', $files)->with('comments', $comments)->with('actions', $actions)->with('query', $query);
}
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$group_id = \App\Group::where('name', '=', 'Flexibility')->pluck('id');
DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Gentle Yoga', 'description' => 'Hatha Yoga, Gentle flow. 90 minutes.', 'days' => 'M W Sa', 'duration_minutes' => '90', 'default_time' => '1700', 'group_id' => $group_id]);
$group_id = \App\Group::where('name', '=', 'Fitness')->pluck('id');
DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Fun Run', 'description' => 'Run with Pacers group from Clarendon Starbucks.', 'days' => 'T Th', 'duration_minutes' => '60', 'default_time' => '0500', 'group_id' => $group_id]);
$group_id = \App\Group::where('name', '=', 'Work')->pluck('id');
DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Work Hours', 'description' => 'Normal work hours.', 'days' => 'M Tu W Th F', 'duration_minutes' => '480', 'default_time' => '0800', 'group_id' => $group_id]);
$group_id = \App\Group::where('name', '=', 'Recreation')->pluck('id');
DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Happy Hour', 'description' => 'Hang out with work folks.', 'days' => 'F', 'duration_minutes' => '120', 'default_time' => '1630', 'group_id' => $group_id]);
$group_id = \App\Group::where('name', '=', 'Family')->pluck('id');
DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Playground', 'description' => 'Take kids to park.', 'days' => 'Su', 'duration_minutes' => '120', 'default_time' => '1300', 'group_id' => $group_id]);
$group_id = \App\Group::where('name', '=', 'Sleep')->pluck('id');
DB::table('activities')->insert(['created_at' => Carbon\Carbon::now()->toDateTimeString(), 'updated_at' => Carbon\Carbon::now()->toDateTimeString(), 'name' => 'Sleep 7 Hours', 'description' => 'Sleep.', 'days' => 'M Tu W Th F Sa Su', 'duration_minutes' => '420', 'default_time' => '2200', 'group_id' => $group_id]);
}
示例10: joinGroup
public function joinGroup($group_id, Request $request)
{
$i_password = $request->input('password');
$group = \App\Group::where('id', '=', $group_id)->get()[0];
//---------------------
if ($i_password !== $group->password) {
return redirect(url('/join-group/' . $group_id));
} else {
$p_user_ids = $group->user_ids;
$model = \App\Group::find($group_id);
$model->user_ids = $p_user_ids . "[" . auth()->user()->id . "]";
$model->save();
// redirect to user's home page .................
return redirect('/home');
}
}
示例11: removegroup
public function removegroup()
{
$groupname = Input::get('selectgroup_name');
$groups = Group::where('group_name', $groupname)->get();
foreach ($groups as $group) {
$offered_to = $group->group_code;
$batchcourses = Course_detail::where('offered_to', $offered_to)->get();
foreach ($batchcourses as $batchcourse) {
//delete schedules data
Schedule::where('course_code', $batchcourse->id)->delete();
Time_table::where('course_code', $batchcourse->id)->delete();
}
// delete class data
Course_detail::where('offered_to', $offered_to)->delete();
}
//delete the group
Group::where('group_name', $groupname)->delete();
return view('layouts.removegroup')->with('deletemsg', 'group Deleted');
}
示例12: check
public function check(Request $request)
{
$code = trim($request->get('group-code'));
$errors = new MessageBag();
$user = Auth::user();
if ($code == '') {
$errors->add('error', "Syötä koodi!");
} elseif ($user->groups()->where('code', $code)->exists()) {
$errors->add('error', "Olet jo liittynyt tähän ryhmään.");
} else {
$group = Group::where('code', $code)->first();
if ($group) {
$user->groups()->attach($group->id);
return view('groups.manage')->with(['groups' => $user->groups, 'success' => true, 'group' => $group]);
} else {
$errors->add('error', "Ryhmää ei löytynyt.");
}
}
return redirect()->back()->with(['groups' => $user->groups])->withInput($request->all())->withErrors($errors);
}
示例13: handle
public function handle()
{
$groupname = $this->argument('groupname');
if ($groupname == '*') {
$groups = Group::all();
} else {
$groups = Group::where('name', '=', $groupname)->get();
}
$pattern = $this->argument('pattern');
foreach ($groups as $group) {
foreach ($group->users as $user) {
$files = Cloud::getContents($user->username, false);
foreach ($files as $file) {
$filename = basename($file);
if (preg_match($pattern, $filename)) {
Cloud::deleteFile($user->username, $filename);
echo "Rimosso {$file}\n";
}
}
}
}
}
示例14: map
/**
* Renders a map of all users (curently)
*/
public function map()
{
$users = \App\User::where('latitude', '<>', 0)->get();
$actions = \App\Action::where('start', '>=', Carbon::now())->where('latitude', '<>', 0)->get();
$groups = \App\Group::where('latitude', '<>', 0)->get();
// randomize users geolocation by a few meters
foreach ($users as $user) {
$user->latitude = $user->latitude + mt_rand(0, 10) / 10000;
$user->longitude = $user->longitude + mt_rand(0, 10) / 10000;
}
return view('dashboard.map')->with('users', $users)->with('actions', $actions)->with('groups', $groups)->with('latitude', 50.8503396)->with('longitude', 4.3517103);
}
示例15: edit
/**
* Show the form for editing the specified resource.
*
* @param Inscription $inscription
* @return Response
*/
public function edit(Inscription $inscription)
{
$this->authorize('edit', $inscription);
//$inscription = Inscription::findOrFail($id);
$semesters = Semester::all()->lists('nombre', 'id');
$inscription->student['semester_id'] = $inscription->semester_id;
//incrustar valor para vincularlo a formulario
$inscription->student['group_id'] = $inscription->group_id;
$groups = Group::where('semester_id', $inscription->semester_id)->lists('nombre', 'id');
return view('inscription.edit', compact('inscription', 'semesters', 'groups'));
}