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


PHP Group::find方法代码示例

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


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

示例1: updateGroups

 public static function updateGroups(Request $request)
 {
     $titles = $request::get('title');
     $ids = $request::get('id');
     $deleteId = $request::get('delete');
     $newtitle = $request::get('newtitle');
     $i = 0;
     if ($ids) {
         foreach ($ids as $id) {
             $group = Group::find($id);
             $group->title = $titles[$i];
             if (isset($deleteId[$i]) && $deleteId[$i] == $id) {
                 $group->delete();
             } else {
                 $group->save();
             }
             $i++;
         }
     }
     if ($newtitle) {
         $group = new Group();
         $group->title = $newtitle;
         $group->save();
     }
     return true;
 }
开发者ID:jtoshmat,项目名称:laravel,代码行数:26,代码来源:Group.php

示例2: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $group = Group::find($id);
     $data['group'] = $group;
     $data['users'] = $group->users;
     return view('group.show', $data);
 }
开发者ID:VolodyaP,项目名称:wapp,代码行数:13,代码来源:GroupController.php

示例3: axsave

 public function axsave(Request $request)
 {
     //
     $response = array('status' => 'success', 'msg' => 'OK!');
     $rules = array('fname' => 'required', 'fremark' => 'required', 'femail' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $response['status'] = "warning";
         $response['msg'] = $validator->messages()->toJson();
         return response()->json($response);
     } else {
         try {
             $gid = Input::get('fid');
             if ($gid != 'Neu') {
                 $group = Group::find($gid);
             } else {
                 $group = new Group();
             }
             $group->name = Input::get('fname');
             $group->remark = Input::get('fremark');
             $group->email = Input::get('femail');
             //$user = \App\User::find(1) ;
             $group->manager()->associate(Input::get('fmanager'));
             $group->save();
         } catch (\Illuminate\Database\QueryException $e) {
             $response['status'] = "danger";
             $response['msg'] = "Database error: " . $e->getMessage();
             return response()->json($response);
         }
         //return Response::json( $response );
         return response()->json($response);
     }
     //validatorf
 }
开发者ID:machiidev,项目名称:lapp1,代码行数:34,代码来源:GroupController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Auth::user()) {
         return redirect('auth/login');
     }
     $groupall = Auth::user()->group()->get();
     $allowed_routes = array();
     foreach ($groupall as $key => $value) {
         $feature = Group::find($value->id)->feature()->get();
         foreach ($feature as $key_fea => $val_fea) {
             $val_fea_j = json_decode($val_fea->url_action);
             if ($val_fea_j != NULL) {
                 foreach ($val_fea_j as $k_valfea => $v_valfea) {
                     array_push($allowed_routes, $v_valfea);
                 }
             } else {
                 array_push($allowed_routes, $val_fea->url_action);
             }
         }
     }
     //view()->share('sidebar', ($this->showSidebar($allowed_routes)));
     App::singleton('allowed_routes', function () use($allowed_routes) {
         return $allowed_routes;
     });
     /*App::after(function ($request, $response) {
     		// Mencegah Kembali Login Setelah Logout dengan Menekan Tombol Back pada Browser
     		$response->headers->set("Cache-Control", "no-cache,no-store, must-revalidate");
     		$response->headers->set("Pragma", "no-cache"); //HTTP 1.0
     		$response->headers->set("Expires", " Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
     		});*/
     view()->share('allowed_routes', $allowed_routes);
     return $next($request);
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:40,代码来源:MyMiddleware.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     // exit();
     // First make sure there is an active session
     // dd(debug_print_backtrace(2));
     // dd(Sentry::check());
     if (!Sentry::check()) {
         // return $next($request);
         exit('tidak login');
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->guest(route('sentinel.login'));
         }
     }
     // Now check to see if the current user has the 'admin' permission
     // dd(get_class(Sentry::getUser()));
     // dd(Sentry::getUser()->hasAccess('admin'));//Sentinel\Models\User
     if (Sentry::getUser()->hasAccess('admin')) {
         dd('admin');
         return $next($request);
     }
     // dd($request->route()->getActionName());//"App\Http\Controllers\ExcelController@getIndex"
     if (!Sentry::getUser()->hasAccess('admin')) {
         // echo 'masukkk bukan admin<br>';
         // dd(\Sentry::getUser()->getGroups()[0]->pivot->group_id);
         //ambil group_id lewat user_id -> lewat pivot users_group
         $group_id = \Sentry::getUser()->getGroups()[0]->pivot->group_id;
         // dd($group_id);
         //melalui group model dengan id diatas => untuk mengambil akses menu  ( menghasilkan list akses menu)
         $akses = Group::find($group_id)->akses()->get()->toArray();
         // $akses = Group::find($group_id)->akses->get()->toArray();
         // dd($akses);
         // echo $akses;
         $currentRoute = $request->route()->getActionName();
         // dd($currentRoute).'-----<br>';
         foreach ($akses as $key => $value) {
             $action = $value['controller'] . '@' . $value['controller_method'];
             // $action=$value['controller'];
             if ($action == $currentRoute && $value['akses'] == 1) {
                 // var_dump( $currentRoute == $action );
                 return $next($request);
             }
         }
         return response('Unauthorized.', 401);
     }
     // dd(Sentry::getUser()->hasAccess('admin'));
     // dd(Sentry::getId());
     // dd(Sentry::getGroups());
     // All clear - we are good to move forward
     // return $next($request);
     if ($request->ajax()) {
         dd('ajaxx');
         return response('Unauthorized.', 401);
     } else {
         Session::flash('error', trans('Sentinel::users.noaccess'));
         return redirect()->route('sentinel.login');
     }
 }
开发者ID:acmadi,项目名称:integrasi,代码行数:66,代码来源:SentryAdminAccess+Backup02+.php

示例6: getGroup

 public function getGroup($groupId)
 {
     $group = Group::find($groupId);
     if (!is_null($group)) {
         return $group->toArray();
     }
     return false;
 }
开发者ID:rhofma,项目名称:rhofma.de,代码行数:8,代码来源:PostService.php

示例7: prepareGroupPageData

 private function prepareGroupPageData($group_id)
 {
     $group_data = \App\Group::find($group_id);
     $groupUserData = \App\Group::getGroupUserData($group_id);
     $user_data = auth()->user();
     $data = ['group_data' => $group_data, 'groupUserData' => $groupUserData, 'user_data' => $user_data];
     return $data;
 }
开发者ID:michael-dean-haynie,项目名称:my-secret-santa,代码行数:8,代码来源:PagesController.php

示例8: listPages

 function listPages()
 {
     $groups = Group::all();
     foreach ($groups as $key => $group) {
         $pages = Group::find($group->id)->getPages;
         $groups[$key]['pages'] = $pages;
     }
     return view('pages', ['groups' => $groups]);
 }
开发者ID:Pwelling,项目名称:laravelCms,代码行数:9,代码来源:PageController.php

示例9: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     $taskid = $this->route('id');
     if (Auth::check()) {
         return Auth::user()->id == Task::find($taskid)->userId || User::find(Auth::id())->hasRole('bpLead') || User::find(Group::find(Task::find($taskid)->group)->user_ID)->id == Auth::id();
     } else {
         return false;
     }
 }
开发者ID:macewanCS,项目名称:lackingllamas,代码行数:14,代码来源:EditTaskRequest.php

示例10: getFeatureGroup

 /**
  * Get features of this group
  *
  * @return [array] [array feature]
  */
 public function getFeatureGroup()
 {
     $groupall = Auth::user()->group()->get();
     foreach ($groupall as $key => $value) {
         $feature = Group::find($value->id)->feature()->get();
         foreach ($feature as $key_fea => $val_fea) {
             array_push($this->listfeaturegroup, array($val_fea->id => $val_fea->url_action));
         }
     }
 }
开发者ID:phanngoc,项目名称:internal-tool,代码行数:15,代码来源:AdminController.php

示例11: leave

 public function leave($id)
 {
     $group = Group::find($id);
     if ($group && Auth::user()->groups()->where('id', $id)->exists()) {
         $user = Auth::user()->groups()->detach($id);
         Session::flash('group_left', true);
         return redirect('/groups/manage');
     }
     return redirect('/groups/manage');
 }
开发者ID:Orvo,项目名称:mlraamattu,代码行数:10,代码来源:GroupsController.php

示例12: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     $faker = Faker\Factory::create();
     //Admin Account
     $user = User::create(['name' => 'Daniel Bühner', 'email' => 'daniel@plxx.de', 'password' => bcrypt('google')]);
     $user->groups()->attach(Group::find(1));
     //Fake Accounts
     for ($i = 0; $i < 10; $i++) {
         $user = User::create(['name' => $faker->name, 'email' => $faker->email, 'password' => bcrypt($faker->password())]);
         $user->groups()->attach(Group::find(2));
     }
 }
开发者ID:plxx,项目名称:pigeon,代码行数:18,代码来源:UserTableSeeder.php

示例13: addUserToGroup

 /**
  * Function adding user to group
  * @param $user_ids array
  * @param $group_id int
  */
 public static function addUserToGroup($user_ids, $group_id)
 {
     $result = false;
     if (count($user_ids) > 1) {
         foreach ($user_ids as $id) {
             $user = User::find($id);
             $result[] = Group::find($group_id)->users()->save($user);
         }
     } else {
         $user = User::find($user_ids)->first();
         $result = Group::find($group_id)->users()->save($user);
     }
     return $result;
 }
开发者ID:VolodyaP,项目名称:wapp,代码行数:19,代码来源:Group.php

示例14: getGroupUserData

 static function getGroupUserData($group_id)
 {
     $group_data = \App\Group::find($group_id);
     $user_ids = $group_data['user_ids'];
     $groupUserData = [];
     while (strlen($user_ids)) {
         $start = strpos($user_ids, '[');
         $end = strpos($user_ids, ']');
         $current_id = substr($user_ids, $start, $end + 1);
         array_push($groupUserData, \App\User::find($current_id[1]));
         $user_ids = substr($user_ids, $end + 1, strlen($user_ids));
     }
     return $groupUserData;
 }
开发者ID:michael-dean-haynie,项目名称:my-secret-santa,代码行数:14,代码来源:Group.php

示例15: index

 public function index()
 {
     $selectedGroup = null;
     if ($groupId = Input::get('group')) {
         $selectedGroup = Group::find($groupId);
     }
     if ($selectedGroup) {
         if (Gate::denies('show', $selectedGroup)) {
             return Redirect::back()->with(['error_message' => "You do not have permission."]);
         }
         $passwords = $selectedGroup->passwords()->paginate(10);
     } else {
         $passwords = Auth::user()->passwords()->paginate(10);
     }
     $groups = Auth::user()->groups()->get();
     return view('password.index', ['passwords' => $passwords, 'groups' => $groups, 'selectedGroup' => $selectedGroup]);
 }
开发者ID:nguyenvanduocit,项目名称:Password-Manager,代码行数:17,代码来源:PasswordController.php


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