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


PHP Auth::user方法代码示例

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


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

示例1: getLoggedinDashboard

 public function getLoggedinDashboard()
 {
     $role = Auth::user()->role;
     if ($role == 'hotel-staff') {
         $branch_code = $this->getStaffBranch();
         $data_room_booked_details = DB::table('hotel_rooms')->join('branch', 'hotel_rooms.branch_code', '=', 'branch.branch_code')->where('branch.branch_code', '=', $branch_code)->where('hotel_rooms.status', '=', 'booked')->count();
         $data_room_details = DB::table('hotel_rooms')->join('branch', 'hotel_rooms.branch_code', '=', 'branch.branch_code')->where('branch.branch_code', '=', $branch_code)->where('hotel_rooms.status', '=', 'available')->count();
         $data_total_sales = DB::table('sales')->where('branch_code', '=', $branch_code)->sum('sale_value');
         $total_client = DB::table('customer')->join('accommodation', 'customer.customer_id', '=', 'accommodation.customer_id')->select('customer.customer_id', 'accommodation.branch_code')->where('accommodation.branch_code', '=', $branch_code)->count();
         $data_room = DB::table('hotel_rooms')->join('branch', 'hotel_rooms.branch_code', '=', 'branch.branch_code')->select('hotel_rooms.room_code', 'hotel_rooms.branch_code', 'hotel_rooms.price_per_night', 'hotel_rooms.description', 'hotel_rooms.status', 'hotel_rooms.image', 'branch.branch_name', 'branch.address', 'branch.email', 'branch.city')->where('branch.branch_code', '=', $branch_code)->where('hotel_rooms.status', '=', 'available')->take(5)->get();
         $data_room_booked = DB::table('accommodation')->join('customer', 'accommodation.customer_id', '=', 'customer.customer_id')->select('customer.fullname', 'accommodation.branch_code', 'accommodation.room_code', 'accommodation.checkin_time', 'accommodation.checkout_time')->where('accommodation.branch_code', '=', $branch_code)->orderBy('checkout_time')->take(5)->get();
         $cancelled = DB::table('refund')->where('date', '=', date('y-m-d'))->where('branch_id', '=', $branch_code)->count('refund_id');
     } else {
         DB::setFetchMode(PDO::FETCH_ASSOC);
         $company_id_logged_user = Auth::user()->comp_id;
         $data_room_details = DB::table('hotel_rooms')->join('branch', 'hotel_rooms.branch_code', '=', 'branch.branch_code')->where('branch.company_id', '=', $company_id_logged_user)->where('hotel_rooms.status', '=', 'available')->count();
         $data_room_booked_details = DB::table('hotel_rooms')->join('branch', 'hotel_rooms.branch_code', '=', 'branch.branch_code')->where('branch.company_id', '=', $company_id_logged_user)->where('hotel_rooms.status', '=', 'booked')->count();
         $data_total_sales = DB::table('sales')->where('company_id', '=', Auth::user()->comp_id)->sum('sale_value');
         $total_client = DB::table('customer')->select('customer_id')->where('company_id', '=', Auth::user()->comp_id)->count();
         $company_id_logged_user = Auth::user()->comp_id;
         $data_room = DB::table('hotel_rooms')->join('branch', 'hotel_rooms.branch_code', '=', 'branch.branch_code')->select('hotel_rooms.room_code', 'hotel_rooms.branch_code', 'hotel_rooms.price_per_night', 'hotel_rooms.description', 'hotel_rooms.status', 'hotel_rooms.image', 'branch.branch_name', 'branch.address', 'branch.email', 'branch.city')->where('branch.company_id', '=', $company_id_logged_user)->where('hotel_rooms.status', '=', 'available')->take(5)->get();
         $data_room_booked = DB::table('accommodation')->join('customer', 'accommodation.customer_id', '=', 'customer.customer_id')->select('customer.fullname', 'accommodation.branch_code', 'accommodation.room_code', 'accommodation.checkin_time', 'accommodation.checkout_time')->where('accommodation.comp_id', '=', Auth::user()->comp_id)->orderBy('checkout_time')->take(5)->get();
         $cancelled = DB::table('refund')->join('branch', 'refund.branch_id', '=', 'branch.branch_code')->where('branch.company_id', '=', Auth::user()->comp_id)->count('refund_id');
     }
     return View::make('dashboard', array('data' => $data_room_details, 'booked' => $data_room_booked_details, 'sales' => $data_total_sales, 'clients' => $total_client, 'room_details' => $data_room, 'room_booked' => $data_room_booked, 'cancelled' => $cancelled));
 }
开发者ID:nimeshmora,项目名称:OCM-Travel-Bratts,代码行数:26,代码来源:DashboardController.php

示例2: find

 public function find($filter = null)
 {
     $query = \DB::table('clients')->join('contacts', 'contacts.client_id', '=', 'clients.id')->where('clients.account_id', '=', \Auth::user()->account_id)->where('contacts.is_primary', '=', true)->where('contacts.deleted_at', '=', null)->select('clients.public_id', 'clients.nit', 'clients.business_name', 'clients.name', 'contacts.first_name', 'contacts.last_name', 'contacts.phone', 'clients.balance', 'clients.paid_to_date', 'clients.work_phone', 'contacts.email', 'custom_value1', 'clients.deleted_at');
     if (!\Session::get('show_trash:client')) {
         $query->where('clients.deleted_at', '=', null);
     }
     if ($filter) {
         $cod1 = substr($filter, 0, 3);
         $cod2 = 'cod';
         $cod3 = 'COD';
         $cod4 = 'Cod';
         $cod5 = substr($filter, 0, 3);
         $cod6 = 'Ind';
         $cod7 = 'ind';
         $cod7 = 'IND';
         if (strcmp($cod5, $cod6) == 0 or strcmp($cod5, $cod7) == 0) {
             $filter = substr($filter, 3);
             $query->where(function ($query) use($filter) {
                 $query->where('clients.custom_value1', 'like', $filter . '%');
             });
         } else {
             if (strcmp($cod1, $cod2) == 0 or strcmp($cod1, $cod3) == 0 or strcmp($cod1, $cod4) == 0) {
                 $filter = substr($filter, 3);
                 $query->where(function ($query) use($filter) {
                     $query->where('clients.public_id', 'like', $filter . '%');
                 });
             } else {
                 $query->where(function ($query) use($filter) {
                     $query->where('clients.name', 'like', '%' . $filter . '%')->orWhere('clients.business_name', 'like', '%' . $filter . '%')->orWhere('clients.nit', 'like', $filter . '%')->orWhere('contacts.first_name', 'like', '%' . $filter . '%')->orWhere('contacts.last_name', 'like', '%' . $filter . '%')->orWhere('contacts.email', 'like', $filter . '%');
                 });
             }
         }
     }
     return $query;
 }
开发者ID:aleguisf,项目名称:fvdev1,代码行数:35,代码来源:ClientRepository.php

示例3: action_show

 /**
  *  get_show takes in a username, finds the user's id from the username, gets the information about the user from the 
  *	followers and critts table and outputs it into the others.profile view
  */
 public function action_show($username)
 {
     // we get the user's id that matches the username
     $user_id = User::where('username', '=', $username)->only('id');
     // declare some default values for variables
     $following = null;
     $followers = 0;
     // if the username is not found, display an error
     if ($user_id == null) {
         echo "This username does not exist.";
     } else {
         if (Auth::user()) {
             // if the user tries to go to his/her own profile, redirect to user's profile action.
             if ($user_id == Auth::user()->id) {
                 return Redirect::to_action('user@index');
             }
             // check if the current user is already following $username
             $following = Follower::where('user_id', '=', Auth::user()->id)->where('following_id', '=', $user_id)->get() ? true : false;
         }
         // eager load the critts with user data
         $allcritts = Critt::with('user')->where('user_id', '=', $user_id);
         // order the critts and split them in chunks of 10 per page
         $critts = $allcritts->order_by('created_at', 'desc')->paginate(10);
         // count the critts
         $critts_count = $allcritts->count();
         // count the followers
         $followers = Follower::where('following_id', '=', $user_id)->count();
         // bind data to the view
         return View::make('others.profile')->with('username', $username)->with('user_id', $user_id)->with('following', $following)->with('followers', $followers)->with('count', $critts_count)->with('critts', $critts);
     }
 }
开发者ID:manishnakar,项目名称:critterapp,代码行数:35,代码来源:others.php

示例4: handleUserWasAuthenticated

 /**
  * Send the response after the user was authenticated.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 protected function handleUserWasAuthenticated(Request $request)
 {
     if (method_exists($this, 'authenticated')) {
         return $this->authenticated($request, Auth::user());
     }
     return redirect()->intended($this->redirectPath());
 }
开发者ID:scrobot,项目名称:backend-auth,代码行数:13,代码来源:AuthController.php

示例5: getDelMember

 public function getDelMember($id)
 {
     $staff = User::find($id);
     if (\Auth::user()->role_id == 1) {
         return view('html.error-403');
     }
     if ($staff->role_id == 4) {
         return view('html.error-403');
     }
     $teams = Team::where('created_user_id', $staff->id)->get();
     if (!empty($team)) {
         foreach ($teams as $key => $value) {
             TeamDetail::where('team_id', $value->id)->delete();
         }
         foreach ($teams as $key => $value) {
             $value->delete();
         }
     }
     $detail = TeamDetail::where('staff_id', $staff->id)->get();
     if (!empty($detail)) {
         foreach ($detail as $key => $value) {
             $value->delete();
         }
     }
     Profile::where('user_id', $staff->id)->first()->delete();
     $staff->delete();
     return redirect()->route('admin.index')->with('success', 'Deleted Successfully!!!');
 }
开发者ID:trongtri0705,项目名称:elinext_project,代码行数:28,代码来源:DepartmentController.php

示例6: setUserEntityTheme

 public function setUserEntityTheme($file, $dataarr)
 {
     $getpersonalcount = DB::table('tbl_bankaccounts')->leftjoin('tbl_bankbranches', 'bankaccount_branch', '=', 'branch_id')->leftjoin('tbl_banks', 'branch_bankid', '=', 'bank_id')->where('bank_isproduct', '0')->where('bankaccount_userentity', 'Personal')->where('bankaccount_createdby', Auth::user()->id)->count();
     $getbusinesscount = DB::table('tbl_bankaccounts')->leftjoin('tbl_bankbranches', 'bankaccount_branch', '=', 'branch_id')->leftjoin('tbl_banks', 'branch_bankid', '=', 'bank_id')->where('bank_isproduct', '0')->where('bankaccount_userentity', 'Business')->where('bankaccount_createdby', Auth::user()->id)->count();
     $resultbViewAcctype = DB::table('tbl_bankaccounttypes')->get();
     $resultbViewAcctypearr = array();
     foreach ($resultbViewAcctype as $data) {
         $resultbViewAcctypearr[$data->accounttype_id] = $data->accounttype_name;
     }
     $resultbViewBanks = DB::table('tbl_banks')->where('bank_isproduct', 0)->where('bank_status', '1')->orderBy('bank_name', 'ASC')->get();
     $resultbViewBanksarr = array();
     foreach ($resultbViewBanks as $data) {
         $resultbViewBanksarr[$data->bank_id] = $data->bank_name;
     }
     $resultbViewBankbranchs = DB::table('tbl_bankbranches')->where("branch_bankid", key($resultbViewBanksarr))->where("branch_status", "1")->get();
     $resultbViewBankBrancharr = array();
     foreach ($resultbViewBankbranchs as $data) {
         $resultbViewBankBrancharr[$data->branch_id] = $data->branch_name;
     }
     if ($getpersonalcount <= 0 and $getbusinesscount <= 0) {
         $data = array('bankaccttype' => $resultbViewAcctypearr, 'bankname' => $resultbViewBanksarr, 'bankbranch' => $resultbViewBankBrancharr);
         $MyTheme = Theme::uses('fonebayad')->layout('ezibills_9_0');
         return $MyTheme->of('registration.firstloginaddbankacct', $data)->render();
     } else {
         //            $MyTheme = Theme::uses('fonebayad')->layout('ezibills_9_0');
         $MyTheme = Theme::uses('fonebayad')->layout('newDefault_myBills');
         return $MyTheme->of($file, $dataarr)->render();
     }
 }
开发者ID:bokbok123,项目名称:ORS,代码行数:29,代码来源:GlobalController.php

示例7: postCreate

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function postCreate()
 {
     // Declare the rules for the form validation
     $rules = array('title' => 'required|min:3', 'content' => 'required|min:3');
     // Validate the inputs
     $validator = Validator::make(Input::all(), $rules);
     // Check if the form validates with success
     if ($validator->passes()) {
         // Create a new blog post
         $user = Auth::user();
         // Update the blog post data
         $this->post->title = Input::get('title');
         $this->post->slug = Str::slug(Input::get('title'));
         $this->post->content = Input::get('content');
         $this->post->meta_title = Input::get('meta-title');
         $this->post->meta_description = Input::get('meta-description');
         $this->post->meta_keywords = Input::get('meta-keywords');
         $this->post->user_id = $user->id;
         // Was the blog post created?
         if ($this->post->save()) {
             // Redirect to the new blog post page
             return Redirect::to('admin/blogs/' . $this->post->id . '/edit')->with('success', Lang::get('admin/blogs/messages.create.success'));
         }
         // Redirect to the blog post create page
         return Redirect::to('admin/blogs/create')->with('error', Lang::get('admin/blogs/messages.create.error'));
     }
     // Form validation failed
     return Redirect::to('admin/blogs/create')->withInput()->withErrors($validator);
 }
开发者ID:sappex,项目名称:viglle_fiji,代码行数:34,代码来源:AdminBlogsController.php

示例8: postRequest

 /**
  * Saves user submissions for Independent Sponsor requests.
  */
 public function postRequest()
 {
     //Grab input
     $address1 = Input::get('address1');
     $address2 = Input::get('address2');
     $city = Input::get('city');
     $state = Input::get('state');
     $postal = Input::get('postal');
     $phone = Input::get('phone');
     $all_input = Input::all();
     //Validate input
     $rules = array('address1' => 'required', 'city' => 'required', 'state' => 'required', 'postal' => 'required', 'phone' => 'required');
     $validation = Validator::make($all_input, $rules);
     if ($validation->fails()) {
         return Redirect::to('/documents/sponsor/request')->withInput()->withErrors($validation);
     }
     //Add new user information to their record
     $user = Auth::user();
     $user->address1 = $address1;
     $user->address2 = $address2;
     $user->city = $city;
     $user->state = $state;
     $user->postal_code = $postal;
     $user->phone = $phone;
     $user->save();
     //Add UserMeta request
     $request = new UserMeta();
     $request->meta_key = UserMeta::TYPE_INDEPENDENT_SPONSOR;
     $request->meta_value = 0;
     $request->user_id = $user->id;
     $request->save();
     return Redirect::to('/user/edit/' . $user->id)->with('message', 'Your request has been received.');
 }
开发者ID:ritvikgautam,项目名称:madison,代码行数:36,代码来源:SponsorController.php

示例9: create

 public function create($type = 'csv')
 {
     try {
         $export = static::getExportForType($type);
     } catch (Exception $e) {
         App::abort(404);
     }
     $export->user_id = Auth::user()->id;
     $export->filename = $export->generateFilename();
     $export->path = $export->folderPath();
     $export->setLogbooks(Input::get('logbooks'));
     $save = Input::has('save') ? (bool) Input::get('save') : true;
     if ($export->run($save)) {
         if ($save == false) {
             $res = Response::make($export->content);
             $res->header('Content-type', $export->getContentType());
             return $res;
         } else {
             $export->save();
             return Response::download($export->fullPath(), $export->filename, ['Content-type' => $export->getContentType()]);
         }
     } else {
         return Redirect::to(action('ExportsController@index'))->with('message', ['content' => 'Er is iets mis gegaan met exporteren.', 'class' => 'danger']);
     }
 }
开发者ID:y0sh1,项目名称:logboek,代码行数:25,代码来源:ExportsController.php

示例10: remove

 public function remove($id)
 {
     $fav = Favorite::where('StudentID', Auth::user()->StudentID)->where('FavoriteID', $id)->where('favorite', '1')->first();
     $fav->favorite = 0;
     $fav->updated_at = date_timestamp_get(date_create());
     $fav->save();
 }
开发者ID:NoName1771,项目名称:QCPU-Social-Web-App,代码行数:7,代码来源:FavoriteController.php

示例11: getAccessToken

 /**
  * @param String|null $code
  * @param User|null $user
  * @return mixed
  */
 public function getAccessToken($code = null, $user = null)
 {
     if ($code) {
         // swap code for access token plus refresh token
         $guzzle = new Client();
         $options = ['headers' => ['User-Agent' => 'Reset app by Ortho Loess, hosted at ' . config('app.url'), 'Authorization' => $this->makeBasicAuthHeader()], 'form_params' => ['grant_type' => 'authorization_code', 'code' => $code]];
         $response = $guzzle->post(config('crest.sso-token-uri'), $options);
         $jsonResponse = json_decode($response->getBody(), true);
         //$this->accessToken = $jsonResponse['access_token'];
         $this->refreshToken = $jsonResponse['refresh_token'];
         return $jsonResponse['access_token'];
     } else {
         // use refresh token to get new access token.
         if (!$user) {
             $user = \Auth::user();
         }
         $token = \Cache::remember('accessToken:' . $user->id, 15, function () use($user) {
             $guzzle = new Client();
             $options = ['headers' => ['User-Agent' => 'Reset app by Ortho Loess, hosted at ' . config('app.url'), 'Authorization' => $this->makeBasicAuthHeader()], 'form_params' => ['grant_type' => 'refresh_token', 'refresh_token' => $user->refreshToken]];
             $response = $guzzle->post(config('crest.sso-token-uri'), $options);
             $jsonResponse = json_decode($response->getBody(), true);
             return $jsonResponse['access_token'];
         });
         return $token;
     }
     // cache access token
 }
开发者ID:OrthoLoess,项目名称:reset,代码行数:32,代码来源:EveSSO.php

示例12: postVote

 public function postVote()
 {
     Input::merge(array_map('trim', Input::all()));
     $input = Input::all();
     $rules = array('MCUsername' => 'required|max:40', 'g-recaptcha-response' => 'required|recaptcha', 'sid' => 'required');
     $v = Validator::make($input, $rules);
     $sid = $input['sid'];
     $server = DB::table('mcservers')->where('mcs_id', '=', $sid)->first();
     if (!count($server)) {
         return Redirect::to('/minecraft/' . $sid)->withErrors("Ocorreu um erro com a validação do servidor");
     }
     if ($v->passes()) {
         if (mcservers::playerHasVoted($sid, $input['MCUsername']) || mcservers::ipHasVoted($sid, $_SERVER["HTTP_CF_CONNECTING_IP"])) {
             return Redirect::to('/minecraft/' . $sid)->withErrors("Já votaste hoje");
         }
         if ($server->mcs_votifier == 1) {
             $votifier = Votifier::newVote($server->mcs_ip, $server->mcs_vport, $server->mcs_votifierkey, $input['MCUsername']);
             if ($votifier == false) {
                 return Redirect::to('/minecraft/' . $sid)->withErrors("Não foi possivel enviar o voto para o servidor, porfavor contacta o admininstrador do mesmo");
             }
         }
         if (Auth::check()) {
             DB::table('users')->where('id', Auth::user()->id)->update(array('votes' => Auth::user()->votes + 1));
             utilities::log("Voted On Server " . $server->mcs_name);
         }
         DB::table('mcservers')->where('mcs_id', $sid)->update(array('mcs_tvotes' => $server->mcs_tvotes + 1, 'mcs_mvotes' => $server->mcs_mvotes + 1));
         DB::table('mcserversvotes')->insert(array('mcsv_sid' => $sid, 'mcsv_player' => $input['MCUsername'], 'mcsv_ip' => $_SERVER["HTTP_CF_CONNECTING_IP"], 'mcsv_day' => date("j"), 'mcsv_month' => date("n"), 'mcsv_year' => date("Y")));
         return Redirect::to('/minecraft/' . $sid)->With('success', 'Voto Registado!');
     } else {
         return Redirect::to('/minecraft/' . $sid)->withErrors($v);
     }
 }
开发者ID:G4brym,项目名称:ServerList.pt,代码行数:32,代码来源:BaseController.php

示例13: is

 public static function is($level)
 {
     if (!is_numeric($level)) {
         $level = self::level($level);
     }
     return Auth::user()->level == $level;
 }
开发者ID:BinaryGeometry,项目名称:aviate,代码行数:7,代码来源:User.php

示例14: updateProfile

 public function updateProfile()
 {
     $name = Input::get('name');
     //$username = Input::get('username');
     $birthday = Input::get('birthday');
     $bio = Input::get('bio', '');
     $gender = Input::get('gender');
     $mobile_no = Input::get('mobile_no');
     $country = Input::get('country');
     $old_avatar = Input::get('old_avatar');
     /*if(\Cashout\Models\User::where('username',$username)->where('id','!=',Auth::user()->id)->count()>0){
           Session::flash('error_msg', 'Username is already taken by other user . Please enter a new username');
           return Redirect::back()->withInput(Input::all(Input::except(['_token'])));
       }*/
     try {
         $profile = \Cashout\Models\User::findOrFail(Auth::user()->id);
         $profile->name = $name;
         // $profile->username = $username;
         $profile->birthday = $birthday;
         $profile->bio = $bio;
         $profile->gender = $gender;
         $profile->mobile_no = $mobile_no;
         $profile->country = $country;
         $profile->avatar = Input::hasFile('avatar') ? \Cashout\Helpers\Utils::imageUpload(Input::file('avatar'), 'profile') : $old_avatar;
         $profile->save();
         Session::flash('success_msg', 'Profile updated successfully');
         return Redirect::back();
     } catch (\Exception $e) {
         Session::flash('error_msg', 'Unable to update profile');
         return Redirect::back()->withInput(Input::all(Input::except(['_token', 'avatar'])));
     }
 }
开发者ID:noikiy,项目名称:turnt-octo-archer,代码行数:32,代码来源:DashboardController.php

示例15: userBanned

 public function userBanned()
 {
     if (Auth::check() && !Auth::user()->is_banned) {
         return Redirect::route('home');
     }
     return View::make('auth.userbanned');
 }
开发者ID:damko,项目名称:phphub,代码行数:7,代码来源:AuthController.php


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