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


PHP User::with方法代码示例

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


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

示例1: show

 /**
  * Displays the specified user.
  *
  * @param int|string $id
  *
  * @return \Illuminate\View\View
  */
 public function show($id)
 {
     $this->authorize('admin.users.show');
     $user = $this->user->with(['roles'])->findOrFail($id);
     $permissions = $this->presenter->tablePermissions($user);
     $formPermissions = $this->presenter->formPermissions($user);
     return view('admin.users.show', compact('user', 'permissions', 'formPermissions'));
 }
开发者ID:stevebauman,项目名称:ithub,代码行数:15,代码来源:UserController.php

示例2: profile

 protected function profile(int $type, string $id_slug)
 {
     $id = unslug($id_slug)[0];
     $user = User::with('location', 'links.network', 'links')->findOrFail($id);
     $myself = \Auth::user() && \Auth::user()->id == $user->id;
     return view('user.profile', compact('id', 'type', 'user', 'myself'));
 }
开发者ID:konato-events,项目名称:web,代码行数:7,代码来源:UserController.php

示例3: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $roles = Role::all();
     $permissions = Permission::all();
     $usersWithRoles = User::with('roles')->orderBy('last_name')->get();
     return view('admin.roles.index', ['roles' => $roles, 'permissions' => $permissions, 'users' => $usersWithRoles]);
 }
开发者ID:scotthummel,项目名称:lambdaphx,代码行数:12,代码来源:RoleController.php

示例4: history

 public function history($match_id)
 {
     $since = Request::input('since', 0);
     $full = Request::input('full', false) === 'true';
     $match = Match::findOrFail($match_id);
     $events = $match->events()->with(['game.beatmap.beatmapset', 'game.scores' => function ($query) {
         $query->with('game')->default();
     }])->where('event_id', '>', $since);
     if ($full) {
         $events->default();
     } else {
         $events->orderBy('event_id', 'desc')->take(config('osu.mp-history.event-count'));
     }
     $events = $events->get();
     if (!$full) {
         $events = $events->reverse();
     }
     $userIds = [];
     foreach ($events as $event) {
         if ($event->user_id) {
             $userIds[] = $event->user_id;
         }
         if ($event->game) {
             foreach ($event->game->scores as $score) {
                 $userIds[] = $score->user_id;
             }
         }
     }
     $users = User::with('country')->whereIn('user_id', array_unique($userIds))->get();
     $users = json_collection($users, new UserCompactTransformer(), 'country');
     $events = json_collection($events, new EventTransformer(), ['game.beatmap.beatmapset', 'game.scores']);
     return ['events' => $events, 'users' => $users, 'all_events_count' => $match->events()->count()];
 }
开发者ID:ameliaikeda,项目名称:osu-web,代码行数:33,代码来源:MatchesController.php

示例5: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $data['users'] = User::with('group')->get();
     $data['createbtn'] = Permission::hasPermission('users.create');
     $data['editbtn'] = Permission::hasPermission('users.edit');
     $data['deletebtn'] = Permission::hasPermission('users.delete');
     return view('users.index', $data);
 }
开发者ID:mahitiinfo,项目名称:rubanbridge,代码行数:13,代码来源:UserController.php

示例6: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $site = Config::get('site');
     if ($result = check_auth_to('YHLB_INDEX')) {
         return $result;
     }
     $data['userList'] = User::with('userRole')->paginate($site['page_size']);
     return view('admin.user.index', $data);
 }
开发者ID:xinzou,项目名称:authority_management,代码行数:14,代码来源:UserController.php

示例7: index

 public function index()
 {
     $users = User::with(['userEvents' => function ($query) {
         $query->where('event_id', 1);
     }])->with(['userTransactions' => function ($query) {
         $query->where('event_id', 1);
     }])->has('userEvents')->has('userTransactions')->get();
     return view('admin.users')->with('users', $users);
 }
开发者ID:aindong,项目名称:cmnterprise-front,代码行数:9,代码来源:RegistrantsController.php

示例8: getHackersWithRating

 public function getHackersWithRating()
 {
     $hackers = [];
     foreach (Application::where("team_id", $this->id)->get() as $app) {
         $hacker = User::with('application', 'application.ratings', 'application.school')->find($app->user_id);
         $hacker['application']['ratinginfo'] = $hacker->application->ratingInfo();
         $hackers[] = $hacker;
     }
     return $hackers;
 }
开发者ID:BoilerMake,项目名称:backend,代码行数:10,代码来源:Team.php

示例9: getUsers

 public function getUsers($limit, $skip)
 {
     //Pega todos os usuários do banco, transforma a Collection em Array para
     //ser armazenada em cache
     $users = User::with('company')->take($limit)->skip($skip)->get()->toArray();
     //Gera o slug do nome para cada usuário
     foreach ($users as $key => $user) {
         $users[$key]['name'] = explode('-', Slug::generate(strtolower($user['name'])));
     }
     return $users;
 }
开发者ID:beingsane,项目名称:SeminarioLocaweb,代码行数:11,代码来源:SocketServerCommand.php

示例10: find

 /**
  * get user by id
  * @param            $id
  * @param bool|false $withRoles
  * @return array|\Illuminate\Database\Eloquent\Collection|\Illuminate\Database\Eloquent\Model|null
  */
 public function find($id, $withRoles = false)
 {
     if ($withRoles) {
         $user = User::with('roles')->withTrashed()->find($id);
     } else {
         $user = User::withTrashed()->find($id);
     }
     if (!is_null($user)) {
         return $user;
     }
     return array();
 }
开发者ID:aysenli,项目名称:laravel5-backend,代码行数:18,代码来源:UserRepository.php

示例11: index

 public function index()
 {
     $name = Input::get('name', '');
     $onlyActive = Input::get('only_active', '');
     $perPage = Input::get('per_page', 50);
     if ($name || $onlyActive) {
         $users = User::simpleSearch($name, $onlyActive)->with('profile')->paginate($perPage);
     } else {
         $users = User::with('profile')->paginate($perPage);
     }
     return view('admin.pages.user.list', compact('users', 'onlyActive', 'name'));
 }
开发者ID:blozixdextr,项目名称:tuasist2,代码行数:12,代码来源:UserController.php

示例12: index

 function index()
 {
     $user_shokushus = User::with('user_shokushus.shokushu')->find($this->user['id']);
     $shokushus = $user_shokushus['user_shokushus'];
     $user_kinmuchi = User::with('user_kinmuchis.kinmuchi')->find($this->user['id']);
     //                return($user_kinmuchi);
     $kinmuchis = $user_kinmuchi['user_kinmuchis'];
     $user_keitais = User::with('user_keitais.keitai')->find($this->user['id']);
     $keitais = $user_keitais['user_keitais'];
     //        return ($keitais);
     return view('my.edit.edit', ['shokushus' => $shokushus, 'kinmuchis' => $kinmuchis, 'keitais' => $keitais]);
 }
开发者ID:phpwh,项目名称:tl-job,代码行数:12,代码来源:EditController.php

示例13: __construct

 public function __construct()
 {
     $this->middleware('auth');
     $user_types = UserType::lists("name", "id");
     $states = State::lists("name", "id");
     $users_count = User::with("state")->latest()->get()->count();
     $universities_count = University::latest()->get()->count();
     $sos_count = SosModel::latest()->get()->count();
     $students_count = Student::latest()->get()->count();
     $companies_count = Company::latest()->get()->count();
     \View::share(compact("users_count", "universities_count", "sos_count", "states", "user_types", "students_count", "companies_count"));
 }
开发者ID:joaonzangoII,项目名称:find_my_campuses_friend,代码行数:12,代码来源:UniversitiesController.php

示例14: findOrThrowException

 /**
  * @param $id
  * @param bool $withRoles
  * @return mixed
  * @throws GeneralException
  */
 public function findOrThrowException($id, $withRoles = false)
 {
     if ($withRoles) {
         $user = User::with('roles')->withTrashed()->find($id);
     } else {
         $user = User::withTrashed()->find($id);
     }
     if (!is_null($user)) {
         return $user;
     }
     throw new GeneralException('That user does not exist.');
 }
开发者ID:qloog,项目名称:laravle5-lvyou,代码行数:18,代码来源:UserRepository.php

示例15: getIndex

 /**
  * Redirect to the profile page.
  *
  * @return Redirect
  */
 public function getIndex()
 {
     $user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find(Auth::user()->id);
     $userlog = $user->userlog->load('assetlog', 'consumablelog', 'assetlog.model', 'licenselog', 'accessorylog', 'userlog', 'adminlog');
     if (isset($user->id)) {
         return View::make('account/view-assets', compact('user', 'userlog'));
     } else {
         // Prepare the error message
         $error = trans('admin/users/message.user_not_found', compact('id'));
         // Redirect to the user management page
         return redirect()->route('users')->with('error', $error);
     }
 }
开发者ID:dmeltzer,项目名称:snipe-it,代码行数:18,代码来源:ViewAssetsController.php


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