當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。