當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Group::where方法代碼示例

本文整理匯總了PHP中Group::where方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::where方法的具體用法?PHP Group::where怎麽用?PHP Group::where使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Group的用法示例。


在下文中一共展示了Group::where方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: users_from_group

 public static function users_from_group($group_name)
 {
     $groups = array_map(function ($group) {
         return $group->id;
     }, Group::where('name', 'LIKE', '%' . $group_name . '%')->get());
     return static::with('group')->where_in('group_id', $groups)->order_by('username', 'asc')->get();
 }
開發者ID:gigikiri,項目名稱:masjid-l3,代碼行數:7,代碼來源:user.php

示例2: postVerify

 public function postVerify()
 {
     $this->beforeFilter('admin');
     $request = Input::get('request');
     $status = Input::get('status');
     if (!Group::isValidStatus($status)) {
         throw new \Exception("Invalid value for verify request");
     }
     $group = Group::where('id', '=', $request['id'])->first();
     if (!$group) {
         throw new \Exception("Invalid Group");
     }
     $group->status = $status;
     DB::transaction(function () use($group) {
         $group->save();
         switch ($group->status) {
             case Group::STATUS_ACTIVE:
                 $group->createRbacRules();
                 break;
             case Group::STATUS_PENDING:
                 $group->destroyRbacRules();
                 break;
         }
     });
     return Response::json($group);
 }
開發者ID:krues8dr,項目名稱:madison,代碼行數:26,代碼來源:GroupsApiController.php

示例3: getIndex

 public function getIndex()
 {
     Allow::permission($this->module['group'], 'users');
     ## Фильтр юзеров по группе
     $group = false;
     $group_id = Input::get('group_id');
     $group_name = Input::get('group');
     $users = new User();
     ## Обрабатываем условия фильтра
     if ($group_id != '' && !is_null($group = Group::where('id', $group_id)->first())) {
         $users = $users->where('group_id', $group->id);
     } elseif ($group_name != '' && !is_null($group = Group::where('name', $group_name)->first())) {
         $users = $users->where('group_id', $group->id);
     }
     #else
     #    $users = User::all();
     if (!Allow::superuser()) {
         $users = $users->where('group_id', '!=', 1);
     }
     $users = $users->get();
     #Helper::tad($users);
     if (@(!is_object($group))) {
         $group = Group::firstOrNew(array('id' => 0));
     }
     $groups = Group::all();
     $groups_ids = array();
     foreach ($groups as $grp) {
         $groups_ids[] = $grp->id;
     }
     return View::make($this->module['tpl'] . 'index', compact('group', 'users', 'groups', 'groups_ids'));
 }
開發者ID:Grapheme,項目名稱:doktornarabote,代碼行數:31,代碼來源:admin_users.controller.php

示例4: createFile

 public function createFile()
 {
     $dbFile = new DBFile();
     $dbFile->name = Input::get('filename');
     $dbFile->path = "";
     $dbFile->uploader = Auth::user()->id;
     $dbFile->size = "Unknown";
     $dbFile->content = "";
     $dbFile->filetype = Input::get('filetype');
     $uploaded = $dbFile->save();
     $allowEditing = Input::get('allowediting');
     $post = new Post();
     $grp = Group::where('uid', '=', Input::get('uid'))->first();
     $filelist = unserialize($grp->files);
     array_push($filelist, $dbFile->id);
     $grp->files = serialize($filelist);
     $grp->save();
     $post->parent = $grp->id;
     $post->title = Auth::user()->firstname . ' ' . Auth::user()->lastname . ' has created a new file.';
     if ($allowEditing) {
         $post->content = 'A new file named \'' . $dbFile->name . '\' has been created. Click <a href="' . URL::to('g/' . $grp->uid . '/edit/' . $dbFile->id) . '">here</a> to edit it.';
     } else {
         $post->content = 'A new file named \'' . $dbFile->name . '\' has been created. Click <a href="' . URL::to('g/' . $grp->uid . '/view/' . $dbFile->id) . '">here</a> to view it.';
     }
     $post->creator = Auth::user()->id;
     $post->save();
     if ($uploaded) {
         return Redirect::to('g/' . Input::get('uid') . '/edit/' . $dbFile->id);
     } else {
         return Response::jscon('error', 400);
     }
 }
開發者ID:kurone-chan,項目名稱:courseboard,代碼行數:32,代碼來源:GroupController.php

示例5: getGroupsAttribute

 /**
  * Get the guest's group, containing only the 'guests' group model.
  *
  * @return Group
  */
 public function getGroupsAttribute()
 {
     if (!isset($this->attributes['groups'])) {
         $this->attributes['groups'] = $this->relations['groups'] = Group::where('id', Group::GUEST_ID)->get();
     }
     return $this->attributes['groups'];
 }
開發者ID:flarum,項目名稱:core,代碼行數:12,代碼來源:Guest.php

示例6: parseQuestionStore

 public static function parseQuestionStore($file, $schoolID, $returnFile = false)
 {
     $file = explode("\n", $file);
     $fileLength = count($file);
     $origMarks = array();
     for ($lineI = 0; $lineI < $fileLength; ++$lineI) {
         $file[$lineI] = explode("|", $file[$lineI]);
         $lineLength = count($file[$lineI]);
         for ($i = 0; $i < $lineLength; ++$i) {
             $valueLength = $valueIndex = strlen($file[$lineI][$i]);
             if ($valueLength) {
                 while ($file[$lineI][$i][--$valueIndex] == '\\') {
                 }
                 if (($valueLength - $valueIndex + 1) % 2) {
                     $file[$lineI][$i] = substr($file[$lineI][$i], 0, $valueLength - 1) . "|" . $file[$lineI][$i + 1];
                     //Move all of the remaining values back.
                     for ($innerI = $i + 1; $innerI < $lineLength - 1; ++$innerI) {
                         $file[$lineI][$innerI] = $file[$lineI][$innerI + 1];
                     }
                     array_pop($file[$lineI]);
                     --$i;
                     --$lineLength;
                 }
             }
         }
         //Line has been completed.
         //Does it have 4 entries only?
         if ($lineLength != 4) {
             return array(false, "Question {$lineI} must have 4 values.");
         }
         //First is Q?
         if ($file[$lineI][0] != "Q") {
             return array(false, "The first value of question {$lineI} must be 'Q'.");
         }
         //All in second value are valid group names for the given schoolID.
         $file[$lineI][1] = explode(',', $file[$lineI][1]);
         $groupsLength = count($file[$lineI][1]);
         $groupRecords = array();
         for ($i = 0; $i < $groupsLength; ++$i) {
             if (is_null(Group::where('school_id', '=', $schoolID)->where('name', '=', $file[$lineI][1][$i])->first())) {
                 return array(false, "Question {$lineI} contains invalid group {$file[$lineI][1][$i]}.");
             }
             foreach ($groupRecords as $groupRecord) {
                 if ($groupRecord == $file[$lineI][1][$i]) {
                     return array(false, "In question {$lineI}, the group {$groupRecord} cannot be repeated.");
                 }
             }
             $groupRecords[] = $file[$lineI][1][$i];
         }
         if (in_array($file[$lineI][2], $origMarks)) {
             return array(false, "In question {$lineI}, the original mark {$file[$lineI][2]} already exists.");
         }
         $origMarks[] = $file[$lineI][2];
     }
     if ($returnFile) {
         return array(true, $file);
     }
     return array(true);
 }
開發者ID:AlexLeung,項目名稱:ibsurvey,代碼行數:59,代碼來源:Survey.php

示例7: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     //get the nerd
     $nerd = Nerd::find($id);
     $group_options = Group::where('active', '=', 1)->lists('group_name', 'id');
     //show the edit view and pass the nerd to it
     return View::make('nerds.edit')->with('nerd', $nerd)->with('group_options', $group_options);
 }
開發者ID:elaine92,項目名稱:crud_operations,代碼行數:14,代碼來源:NerdController.php

示例8: viewGroup

 public function viewGroup($name, $mode = 'default')
 {
     $group = Group::where('group_name', $name)->firstOrFail();
     $subscription = Gsub::where('user_fp', self::userFp())->where('group_name', $name)->first();
     $subscribers = Gsub::where('group_name', $name)->count();
     $subscribers = DB::table('gsubs')->where('gsubs.group_name', $name)->join('users', 'users.user_fp', '=', 'gsubs.user_fp')->select('gsubs.id', 'users.*')->get();
     return View::make('board.group', ['mode' => $mode, 'posts' => Post::group($name, $mode, self::getBL()), 'subscription' => $subscription, 'subscribers' => $subscribers, 'group' => $group]);
 }
開發者ID:libre-net-society,項目名稱:onelon,代碼行數:8,代碼來源:PostController.php

示例9: show

 public function show($id)
 {
     if (Auth::user()->is_admin) {
         $grupo = Group::where('id', $id)->first();
         return View::make('grupos.show')->with('grupo', $grupo);
     }
     return Redirect::to('/inicio');
 }
開發者ID:Vrian7ipx,項目名稱:repocas,代碼行數:8,代碼來源:GroupController.php

示例10: showFellowSelect

 public function showFellowSelect($city_id)
 {
     $fellowName = "Propel Fellow";
     $home = new HomeController();
     $year = $home->get_year();
     $fellows = Group::where('name', '=', $fellowName)->first()->fellow()->distinct()->where('city_id', '=', $city_id)->where('year', '=', $year)->where('status', '=', '1')->where('user_type', '=', 'volunteer')->get();
     //return $fellows;
     return View::make('city.select-fellow')->with('fellows', $fellows);
 }
開發者ID:makeadiff,項目名稱:propel,代碼行數:9,代碼來源:CityChangeController.php

示例11: findGroupByID

 public function findGroupByID($group_id)
 {
     $group = \Group::where('id', '=', $group_id)->first();
     if ($group) {
         return $group;
     } else {
         return false;
     }
 }
開發者ID:boweiliu,項目名稱:seat,代碼行數:9,代碼來源:SeatGuard.php

示例12: statGroups

 private static function statGroups()
 {
     $groups = DB::table('posts')->where('parent_id', '=', 0)->where('timestamp', '>', Carbon\Carbon::now()->subMonth())->whereIn('group_name', Group::where('is_featured', 1)->lists('group_name'))->lists('group_name');
     $result = [];
     foreach ($groups as $g) {
         $result[$g] = Post::where('group_name', '=', $g)->count();
     }
     arsort($result);
     return array_slice($result, 0, 30);
 }
開發者ID:libre-net-society,項目名稱:onelon,代碼行數:10,代碼來源:Group.php

示例13: getGroupverifications

 public function getGroupverifications()
 {
     $user = Auth::user();
     if (!$user->can('admin_verify_users')) {
         return Redirect::to('/dashboard')->with('message', "You do not have permission");
     }
     $groups = Group::where('status', '!=', Group::STATUS_ACTIVE)->get();
     $data = array('page_id' => 'verify_groups', 'page_title' => 'Verify Groups', 'requests' => $groups);
     return View::make('dashboard.verify-group', $data);
 }
開發者ID:krues8dr,項目名稱:madison,代碼行數:10,代碼來源:DashboardController.php

示例14: subscriberCounterStat

 public function subscriberCounterStat()
 {
     $count = 0;
     $subscriber = Group::where('name', 'LIKE', '%ubscrib%')->first();
     if ($subscriber) {
         $related = Groups::getRelationProvider()->createModel()->where('group_id', '=', $subscriber->id);
         $count = count($related->get());
     }
     $this->widgetData = array('count' => $count);
     $this->setupWidgetLayout(__METHOD__);
 }
開發者ID:sgh1986915,項目名稱:laravel-bizgym,代碼行數:11,代碼來源:AppWidget.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('user_group')->delete();
     $lukas = User::where('username', '=', 'Lukas Bindreiter')->firstOrFail();
     $philipp = User::where('username', '=', 'Philipp Hofer')->firstOrFail();
     $megacities = Group::where('name', '=', 'Megacities')->firstOrFail()->id;
     $house = Group::where('name', '=', 'House, mouse ...')->firstOrFail()->id;
     $ly = Group::where('name', '=', 'Last year')->firstOrFail()->id;
     $lukas->groups()->sync(array($megacities, $house));
     $philipp->groups()->sync(array($megacities, $ly));
 }
開發者ID:PhilippHofer,項目名稱:ev,代碼行數:16,代碼來源:UserGroupTableSeeder.php


注:本文中的Group::where方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。