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


PHP User::join方法代码示例

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


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

示例1: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $user = Auth::user();
     $books = Book::all();
     $transactions = User::join('book_users', 'users.id', '=', 'book_users.user_id')->join('books', 'books.id', '=', 'book_users.book_id')->select('books.title', 'users.name', 'book_users.created_at', 'book_users.updated_at', 'book_users.status')->whereNotIn('status', ['pesan'])->get();
     return view('operator.borrow.index', ['user' => $user, 'books' => $books, 'transactions' => $transactions]);
 }
开发者ID:satriowisnugroho,项目名称:LIST,代码行数:12,代码来源:BorrowController.php

示例2: getIndex

 public function getIndex()
 {
     if (Auth::check()) {
         $clan = User::join('grad as g', 'g.id', '=', 'korisnici.grad_id')->where('username', Auth::user()->username)->get(['korisnici.id', 'username', 'email', 'prezime', 'ime', 'adresa', 'g.naziv as grad', 'telefon', 'bio', 'foto', 'naslovna', 'ocena'])->first();
         return view('administracija.admin.profil')->with('clan', $clan)->with('mojProfil', $clan->id == Auth()->user()->id ? 'true' : null);
     }
 }
开发者ID:duxor,项目名称:GUSLE,代码行数:7,代码来源:KorisniciKO.php

示例3: postRegister

 /**
  * Post registration data
  * @param  Request $request
  * @return redirect
  */
 public function postRegister(Request $request)
 {
     $this->validate($request, ['email' => 'required|email|unique:users']);
     $user = User::join($request->all());
     $this->userMailer->sendVerificationEmail($user);
     flash('Kiitos rekisteröitymisestä. Saat pian sähköpostin, jossa on varmistuslinkki sovelluksen käyttämiseksi.');
     return redirect()->back();
 }
开发者ID:villeglad,项目名称:katujen-puhdistus-email-palvelu,代码行数:13,代码来源:RegistrationsController.php

示例4: show

 /**
  * @param Project $project
  * @return \Illuminate\View\View
  */
 public function show(Project $project)
 {
     $projectsRelation = $this->projectModel->getProjects()->limit(6)->get();
     $contactInfo = User::join('profiles', 'users.id', '=', 'profiles.user_id')->where('user_id', $project->user_id)->first();
     $preview = Project::isApproved(1)->where('id', '<', $project->id)->orderBy('id', 'desc')->first();
     $next = Project::isApproved(1)->where('id', '>', $project->id)->orderBy('id', 'asc')->first();
     return view('front.projects.show', compact('project', 'projectsRelation', 'contactInfo', 'preview', 'next'));
 }
开发者ID:khanhpnk,项目名称:sbds,代码行数:12,代码来源:ProjectController.php

示例5: postClanovi

 public function postClanovi()
 {
     $izlaz = ['podaci' => Korisnici::join('grad as g', 'g.id', '=', 'grad_id')->join('vrsta_korisnika as v', 'v.id', '=', 'vrsta_korisnika_id')->where('vrsta_korisnika_id', 'Like', Input::get('vrsta_korisnika') == 1 ? '%%' : Input::get('vrsta_korisnika'))->where('grad_id', 'Like', Input::get('grad') == 1 ? '%%' : Input::get('grad'))->where(DB::raw('concat(ime," ",prezime)'), 'Like', '%' . Input::get('pretraga') . '%')->skip(Input::has('stranica') ? Input::get('stranica') * $this->ukupnoClanovaPretrage : 0)->take($this->ukupnoClanovaPretrage)->get(['prezime', 'ime', 'username', 'korisnici.foto', 'g.naziv as grad', 'v.naziv as vrsta'])->toArray()];
     if (Input::has('init')) {
         $izlaz['init'] = ceil(Korisnici::join('grad as g', 'g.id', '=', 'grad_id')->join('vrsta_korisnika as v', 'v.id', '=', 'vrsta_korisnika_id')->where('vrsta_korisnika_id', 'Like', Input::get('vrsta_korisnika') == 1 ? '%%' : Input::get('vrsta_korisnika'))->where('grad_id', 'Like', Input::get('grad') == 1 ? '%%' : Input::get('grad'))->where(DB::raw('concat(prezime," ",ime)'), 'Like', '%' . Input::get('pretraga') . '%')->count() / $this->ukupnoClanovaPretrage);
     }
     return json_encode($izlaz);
 }
开发者ID:duxor,项目名称:GUSLE,代码行数:8,代码来源:PretragaKO.php

示例6: getUser

 /**
  * Gets a user or users for the database.
  *
  * @param $id = false
  * @return object
  */
 public static function getUser($id = false)
 {
     if ($id === false) {
         $users = User::join('role_user', 'users.id', '=', 'role_user.user_id')->join('roles', 'role_user.role_id', '=', 'roles.id')->select('users.id', 'users.name', 'users.email', 'roles.name AS role_name', 'users.photo')->groupBy('users.id')->get();
     } else {
         $users = User::where('users.id', $id)->join('role_user', 'users.id', '=', 'role_user.user_id')->join('roles', 'role_user.role_id', '=', 'roles.id')->select('users.id', 'users.name', 'users.email', 'roles.name AS role_name', 'roles.id AS role_id', 'users.photo')->get();
     }
     return $users;
 }
开发者ID:dericcain,项目名称:OrgHealthTC,代码行数:15,代码来源:User.php

示例7: manageExisting

 public function manageExisting()
 {
     $admin = \Auth::user();
     $user = User::join('role_user', function ($join) {
         $join->on('Users.id', '=', 'role_user.user_id');
     })->join('roles', 'roles.id', '=', 'role_user.role_id')->get(['Users.id', 'Users.name', 'Users.name', 'Users.email', 'Users.username', 'Users.na', 'roles.name as rolename']);
     $title = 'Manage Existing User';
     return view('page.useradmin')->with('title', $title)->with('users', $user)->with('admin', $admin);
 }
开发者ID:muhamadanjar,项目名称:SIMTARU,代码行数:9,代码来源:UserController.php

示例8: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     //$this->authorize('user.read');
     if (Gate::denies('user.read')) {
         return view(config('app.template') . '.error.403');
     }
     $users = User::join('karyawans', 'users.id', '=', 'karyawans.user_id')->with(['roles'])->where('users.active', 1)->select(['users.*', 'karyawans.nama'])->get();
     $data = ['users' => $users];
     return view(config('app.template') . '.user.table', $data);
 }
开发者ID:sopoisun,项目名称:narotser-hadni-kodnop,代码行数:15,代码来源:UserController.php

示例9: index

 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index(Request $request)
 {
     $id = $request->input('id');
     if (!empty($id)) {
         $data = User::join('user_interests', 'user_id', '=', 'users.id')->where('interest_id', $id)->distance(14.5, 121, 121.024)->get();
     } else {
         $data = User::distance(14.5, 121, 121.024)->get();
     }
     $users = User::where('id', '!=', Auth::id())->get();
     return view('account.index', compact('users', 'data'));
 }
开发者ID:hack-mnl,项目名称:enjoin,代码行数:16,代码来源:HomeController.php

示例10: giveUsers

 public function giveUsers(Request $request, $id)
 {
     $signedUp = false;
     $data = $request->all();
     $user = User::join('user_sessions', 'user_sessions.user_id', '=', 'users.id')->where('user_sessions.session_id', '=', $id)->where('user_sessions.status', '=', 1)->get();
     foreach ($user as $key) {
         if ($key->user_id == $data['user_id']) {
             $signedUp = true;
         }
     }
     return response()->json(['success' => 'true', 'users' => $user, 'signed_up' => $signedUp]);
 }
开发者ID:bradbernard,项目名称:StudyCorner-Web,代码行数:12,代码来源:SessionController.php

示例11: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $users = User::where('role', '=', 2)->get();
     $clients = User::where('role', '=', 3)->get();
     $test = User::join('assigns', function ($join) {
         $join->on('users.id', '=', 'assigns.id_client');
     })->get();
     foreach ($test as $key => $value) {
         $clients->forget($key);
     }
     return view('assign.create', compact('users', 'clients'));
 }
开发者ID:AlibiGhazi,项目名称:l5-pg,代码行数:17,代码来源:assignController.php

示例12: top

 public function top($sort_type, $limit = 5)
 {
     $selectors = array('facebook_id', 'name');
     // no type specified, fetches overall average
     $selector = '0';
     foreach (RATING::$RATING_TYPES as $type) {
         $query = sprintf('sum( %s ) / count( * )', RATING::RATING_COLUMN_PREFIX . $type);
         $selector .= '+ ' . $query;
         $selectors[] = DB::raw($query . 'as ' . $type);
     }
     $selectors[] = DB::raw(sprintf('(%s)/%d as avg', $selector, count(RATING::$RATING_TYPES)));
     $results = User::join('ratings', 'ratings.user_id_to', '=', 'users.facebook_id')->select($selectors)->groupBy('facebook_id')->orderBy(in_array($sort_type, RATING::$RATING_TYPES) ? $sort_type : 'avg', 'desc')->take($limit)->get();
     return response()->json($results);
 }
开发者ID:kelsie1231,项目名称:StalkyServerSide,代码行数:14,代码来源:UserController.php

示例13: related

 public function related(Request $request)
 {
     $user = User::findOrFail($request->input('id'));
     $skills = $user->skills;
     $skill_categories = $skills->lists('sub_category_id')->toArray();
     $skill_categories = implode(',', $skill_categories);
     $info = $user->info;
     $city_id = $info->city_id == null ? 0 : $info->city_id;
     $province_id = $info->province_id == null ? 0 : $info->province_id_id;
     $users = User::join('skills', 'skills.user_id', '=', 'users.id')->join('infos', 'infos.user_id', '=', 'users.id')->select(DB::raw("(CASE WHEN skills.sub_category_id IN (" . $skill_categories . ") THEN 1 ELSE 0 END) +\n                (CASE WHEN users.first_name LIKE '%" . $user->first_name . "%' THEN 10 ELSE 0 END) +\n                (CASE WHEN users.last_name LIKE '%" . $user->last_name . "%' THEN 1 ELSE 0 END) +\n                (CASE WHEN infos.city_id = " . $city_id . " THEN 10 ELSE 0 END) +\n                (CASE WHEN infos.province_id = " . $province_id . " THEN 5 ELSE 0 END) +\n                (CASE WHEN skills.title = " . $province_id . " THEN 5 ELSE 0 END)\n             AS relevance"))->get();
     dd($users);
     $categories = $user->skills->lists('category_id', 'sub_category_id')->toArray();
     dd($categories);
 }
开发者ID:emadmrz,项目名称:Hawk,代码行数:14,代码来源:ProfileController.php

示例14: paginateusers

 /**
  * Obtener la paginación de los usuarios
  *
  * @param $limit
  * @return mixed
  */
 protected function paginateusers($limit, $departamento = null)
 {
     $user = Users::join('detalle_usuario', function ($join) {
         $join->on('detalle_usuario.id', '=', 'users.id');
     })->join('roles', function ($join) {
         $join->on('roles.id_rol', '=', 'detalle_usuario.id_rol');
     })->join('departamentos', function ($join) {
         $join->on('departamentos.id_departamento', '=', 'users.id_departamento');
     })->select(['users.id', 'users.name AS nombre', 'users.username', 'users.email', 'users.created_at', 'departamentos.name AS departamento', DB::raw("GROUP_CONCAT(roles.name SEPARATOR ', ') AS roles"), 'users.status'])->groupBy('users.id');
     if (isset($departamento)) {
         if ($departamento != 'todos') {
             $user->where('departamentos.id_departamento', $departamento);
         }
     }
     return $user->paginate($limit);
 }
开发者ID:coderdiaz,项目名称:deprofessional,代码行数:22,代码来源:UserController.php

示例15: ranking

 public function ranking()
 {
     $users = User::join('users_stats', 'users.id', '=', 'users_stats.user_id')->orderBy('users_stats.wins', 'desc')->take(10)->paginate();
     $users->setPath('');
     return view('app.ranking', compact('users'));
 }
开发者ID:eduarguzher,项目名称:BattleshipV2.0,代码行数:6,代码来源:HomeController.php


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