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


PHP Group::find方法代码示例

本文整理汇总了PHP中Group::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Group::find方法的具体用法?PHP Group::find怎么用?PHP Group::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Group的用法示例。


在下文中一共展示了Group::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getIndex

 public function getIndex()
 {
     $action = $_GET['action'];
     if ($action == "update") {
         $to = $_GET['to'];
         $id = $_GET['id'];
         $groupEntry = Group::find($id);
         $groupEntry->name = $to;
         $groupEntry->save();
     } else {
         if ($action == "delete") {
             $id = $_GET['id'];
             $groupEntry = Group::find($id);
             $groupEntry->delete();
         } else {
             if ($action == "insert") {
                 $name = $_GET['name'];
                 $group = new Group();
                 $group->name = $name;
                 $group->save();
             }
         }
     }
     return View::make('admin');
 }
开发者ID:PhilippHofer,项目名称:ev,代码行数:25,代码来源:GroupController.php

示例2: destroy

 public function destroy($id)
 {
     if (Auth::user()->is_admin) {
         $count = 0;
         $grupo = Group::find($id);
         $users = User::select('group_ids')->get();
         foreach ($users as $key => $user) {
             $u = $user->group_ids;
             $uarray = explode(',', $u);
             if (in_array($id, $uarray, true)) {
                 $count = $count + 1;
             }
         }
         if ($count > 0) {
             $field = $count == 1 ? ' ' : 's';
             $field2 = $count == 1 ? ' pertenece' : ' pertenecen';
             $message = $count . " Usuario" . $field . $field2 . " al grupo " . $grupo->name;
             Session::flash('error', $message);
             return Redirect::to('grupos/' . $id);
         } else {
             $grupo->delete();
             $message = "Grupo Eliminado con éxito";
             Session::flash('message', $message);
             return Redirect::to('grupos');
         }
     }
 }
开发者ID:Vrian7ipx,项目名称:repocas,代码行数:27,代码来源:GroupController.php

示例3: edit

 public static function edit($id)
 {
     self::check_logged_in();
     $group = Group::find($id);
     $members = User::all();
     $users = User::getMembers($id);
     View::make('group/edit.html', array('attributes' => $group, 'members' => $members, 'users' => $users));
 }
开发者ID:Hecarrah,项目名称:Tsoha-Bootstrap,代码行数:8,代码来源:groupController.php

示例4: edit

 /**
  * Show the form for editing the specified group.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     if (!Sentry::getUser()) {
         return Redirect::route('sessions.create');
     }
     $group = Group::find($id);
     return View::make('groups.edit', compact('group'));
 }
开发者ID:dynamicsystems,项目名称:TechTracker,代码行数:14,代码来源:GroupsController.php

示例5: getPermission

 /**
  * Retourne le champ permission
  *
  */
 public function getPermission()
 {
     if (Auth::check()) {
         $group = Auth::user()->group;
     } else {
         $group = Group::find(2);
     }
     return Permission::whereRaw('forum_id = ? AND group_id = ?', array($this->id, $group->id))->first();
 }
开发者ID:raphaeljorge,项目名称:tor,代码行数:13,代码来源:Forum.php

示例6: get_show

 public function get_show($group_id)
 {
     $modules = Group::find($group_id)->modules()->order_by('order', 'asc')->get();
     $array = array_map(function ($object) {
         return $object->to_array();
     }, $modules);
     $data = array('aaData' => $array);
     return Response::json($data);
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:9,代码来源:modules.php

示例7: approve

 public function approve()
 {
     if (Request::ajax()) {
         $pending = PendingGroup::find(Input::get('id'));
         Group::find($pending->group_id)->push('students_id', $pending->student_id, true);
         $pending->delete();
         return Response::json(array('code' => "00", 'stats' => MessageController::getStats()));
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:9,代码来源:PendingGroupController.php

示例8: paginate_all

 static function paginate_all($limit, $page)
 {
     $offset = $limit * ($page - 1);
     $result = Group::find('all', array('limit' => $limit, 'offset' => $offset, 'order' => 'id DESC'));
     if ($result) {
         return $result;
     } else {
         return FALSE;
     }
 }
开发者ID:csiber,项目名称:CodeIgniter-Starter,代码行数:10,代码来源:group.php

示例9: fetch

 /**
  * Fetch a single group based on the value of a given column.
  *
  * For non-unique columns, it will return the first entry found.  Returns false if no match is found.
  * @param value $value The value to find.
  * @param string $name The name of the column to match (defaults to id)
  * @return Group
  */
 public static function fetch($value, $name = "id")
 {
     if ($name == "id") {
         // Fetch by id
         return Group::find($value);
     } else {
         // Fetch by some other column name
         return Group::where($name, $value)->first();
     }
 }
开发者ID:andriyrusyn,项目名称:tracker,代码行数:18,代码来源:GroupLoader.php

示例10: actByProduct

 protected function actByProduct($method, $id)
 {
     if ($id = static::idFrom($id) and $model = Product::find($id) and $model->group) {
         $group = Group::find($model->group);
         if ($group and $group = $group->root()) {
             $this->layout = '.' . substr(strrchr($method, '_'), 1);
             return $this->{$method}($group);
         }
     }
 }
开发者ID:SerdarSanri,项目名称:VaneMart,代码行数:10,代码来源:Group.php

示例11: pageGroupAuthorization

 public function pageGroupAuthorization($group_id)
 {
     // Access-controlled page
     if (!$this->_app->user->checkAccess('uri_authorization_settings')) {
         $this->_app->notFound();
     }
     $group = Group::find($group_id);
     // Load all auth rules
     $rules = GroupAuth::where('group_id', $group_id)->get();
     $this->_app->render('config/authorization.twig', ["group" => $group, "rules" => $rules]);
 }
开发者ID:Jarby-dev,项目名称:UserFrosting,代码行数:11,代码来源:GroupController.php

示例12: inviteMember

 public function inviteMember()
 {
     $email = Input::get('email');
     $newmember = User::where('email', '=', $email)->firstOrFail();
     $group = Group::find(Input::get('groupid'));
     $gmembers = unserialize($group->members);
     array_push($gmembers, $newmember->id);
     $group->members = serialize($gmembers);
     $group->save();
     return Redirect::to('g/' . $group->uid);
 }
开发者ID:kurone-chan,项目名称:courseboard,代码行数:11,代码来源:GroupController.php

示例13: view

 public function view($id)
 {
     $group = Group::find($id);
     $group->views += 1;
     $group->save();
     if (Auth::guest()) {
         $group->ismember = false;
     } else {
         $group->ismember = $this->checkmembers($id);
     }
     return View::make('group.view')->with('group', $group);
 }
开发者ID:shinichi81,项目名称:laravel4demo,代码行数:12,代码来源:GroupController.php

示例14: __construct

 public function __construct()
 {
     if (!Auth::guest()) {
         $user_id = Auth::user()->id;
         $modules = Cache::get($user_id . 'modules', function () use($user_id) {
             $group_id = Auth::user()->group_id;
             $modules = Group::find($group_id)->modules()->order_by('order', 'asc')->get();
             Cache::forever($user_id . 'modules', $modules);
             return $modules;
         });
         return View::share('navigation_modules', $modules);
     }
 }
开发者ID:gigikiri,项目名称:masjid-l3,代码行数:13,代码来源:base.php

示例15: showAllAssignmentView

 public function showAllAssignmentView()
 {
     if (!is_null(Input::get('group_code'))) {
         Session::put('group_code', Input::get('group_code'));
     }
     if (Session::has('group_code')) {
         $group = Group::find(new MongoId(Session::get('group_code')));
         $students = Student::whereIn('_id', $group->students_id)->get();
         return View::make('student.show_all_assignment')->with(array('group' => $group, 'assignments' => $this->evaluateAssignments($group->_id), 'students' => $students));
     } else {
         return Redirect::to(Lang::get('routes.student'));
     }
 }
开发者ID:ronnysuero,项目名称:devsfarm,代码行数:13,代码来源:AssignmentController.php


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