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


PHP Group::where方法代码示例

本文整理汇总了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);
 }
开发者ID:stryker250,项目名称:simple_ticket,代码行数:34,代码来源:EmailUpdatedTicket.php

示例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);
 }
开发者ID:Jemok,项目名称:skoolspace,代码行数:12,代码来源:Controller.php

示例3: getSeries

 public function getSeries($slug)
 {
     $group = Group::where('slug', 'like', $slug)->first();
     if (is_null($group)) {
         return false;
     }
     return $group->toArray();
 }
开发者ID:rhofma,项目名称:rhofma.de,代码行数:8,代码来源:SeriesService.php

示例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);
 }
开发者ID:VolodyaP,项目名称:wapp,代码行数:13,代码来源:Group.php

示例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;
 }
开发者ID:etciberoamerica,项目名称:robotica,代码行数:10,代码来源:GroupstaController.php

示例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'));
 }
开发者ID:strikles,项目名称:php,代码行数:16,代码来源:SearchController.php

示例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);
 }
开发者ID:BlueBayTravel,项目名称:deployer,代码行数:19,代码来源:NavigationComposer.php

示例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);
     }
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:50,代码来源:SearchController.php

示例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]);
 }
开发者ID:eldaronco,项目名称:p4,代码行数:20,代码来源:ActivitiesTableSeeder.php

示例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');
     }
 }
开发者ID:michael-dean-haynie,项目名称:my-secret-santa,代码行数:16,代码来源:PagesController.php

示例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');
 }
开发者ID:nikeshakya,项目名称:KU-SMS,代码行数:19,代码来源:GroupController.php

示例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);
 }
开发者ID:Orvo,项目名称:mlraamattu,代码行数:20,代码来源:GroupsController.php

示例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";
                 }
             }
         }
     }
 }
开发者ID:OfficineDigitali,项目名称:tiret,代码行数:22,代码来源:MassiveRemove.php

示例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);
 }
开发者ID:philippejadin,项目名称:Mobilizator,代码行数:15,代码来源:DashboardController.php

示例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'));
 }
开发者ID:afelipelc,项目名称:Bachilleratos-Digitales-Laravel,代码行数:17,代码来源:InscriptionController.php


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