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


PHP Facades\Auth类代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Auth的典型用法代码示例。如果您正苦于以下问题:PHP Auth类的具体用法?PHP Auth怎么用?PHP Auth使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param Closure|\Closure $next
  * @param $permissions
  * @return mixed
  * @internal param $roles
  * @internal param null|string $guard
  */
 public function handle(Request $request, Closure $next, $permissions)
 {
     if (Auth::guest() || !$request->user()->can(explode('|', $permissions))) {
         abort(403);
     }
     return $next($request);
 }
开发者ID:Matth--,项目名称:privileges,代码行数:17,代码来源:PrivilegesPermissionMiddleware.php

示例2: slots

 public function slots()
 {
     $user = Auth::user();
     $location = $user->location;
     $slot = Slot::where('location', '=', $location)->first();
     $input = Input::get('wager');
     $owner = User::where('name', '=', $slot->owner)->first();
     $num1 = rand(1, 10);
     $num2 = rand(5, 7);
     $num3 = rand(5, 7);
     if ($user->name != $owner->name) {
         if ($num1 & $num2 & $num3 == 6) {
             $money = rand(250, 300);
             $payment = $money += $input * 1.75;
             $user->money += $payment;
             $user->save();
             session()->flash('flash_message', 'You rolled three sixes!!');
             return redirect('/home');
         } else {
             $user->money -= $input;
             $user->save();
             $owner->money += $input;
             $owner->save();
             session()->flash('flash_message_important', 'You failed to roll three sixes!!');
             return redirect(action('SlotsController@show', [$slot->location]));
         }
     } else {
         session()->flash('flash_message_important', 'You own this slot!!');
         return redirect(action('SlotsController@show', [$slot->location]));
     }
 }
开发者ID:mathewsandi,项目名称:MafiaGame,代码行数:31,代码来源:SlotsController.php

示例3: store

 public function store()
 {
     $this->record = new Activity(array_merge(Request::all(), ['adder_id' => Auth::User()->id, 'modifier_id' => Auth::User()->id]));
     try {
         switch ($this->related_type) {
             case 'lead':
                 $this->relatedObj = new \App\Lead();
                 break;
             case 'contact':
                 $this->relatedObj = new \App\Contact();
                 break;
             case 'account':
                 $this->relatedObj = new \App\Account();
                 break;
             case 'opportunity':
                 $this->relatedObj = new \App\Opportunity();
                 break;
             default:
         }
         $obj = $this->relatedObj->find($this->related_id);
         if ($this->validated()) {
             $obj->activities()->save($this->record);
         }
     } catch (\Exception $e) {
         Session::flash('pageError', 'Error saving activity.' . $e->getMessage());
         return View('activity/activity-new', ['record' => $this->record, 'relates_to' => $this->relates_to]);
     }
     $redirectURL = Request::input('action') == 'saveNew' ? '/activity/create?related_type=' . $this->related_type . '&related_id=' . $this->related_id : '/' . $this->related_type . '/' . $this->related_id;
     return redirect($redirectURL)->with('pageSuccess', 'Activity saved successfully.');
 }
开发者ID:reimo,项目名称:crm-laravel,代码行数:30,代码来源:ActivityController.php

示例4: store

 /**
  * Store a newly created resource in storage.
  *
  * @param AdduserRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(AdduserRequest $request)
 {
     //        $input = $request->all();                               // get all data
     //        $input['confirmed'] = 1;                                // set confirmed to 1
     //        $input['password'] = Hash::make($input['password']);    // hash password
     //
     //        $user       =   User::create($input);                   // save above details
     $user = User::create(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'email' => $request->email, 'confirmed' => 1, 'password' => Hash::make($request->password)]);
     //        $profile    =   $user->profile()->save(new Profile);    // also create new profile
     //        $profile->apartment_id  =   Auth::user()->profile->defaultApartment; // get current defaultApartment
     //        $profile->save();                                       // save details on profile
     $profile = Profile::create(['user_id' => $user->id, 'apartment_id' => Auth::user()->profile->defaultApartment]);
     dd(Auth::user()->profile->defaultApartment);
     $role = Role::whereName('user')->first();
     $user->assignRole($role);
     //Assign Role
     $block_no = $request->blockno;
     // get block_no from profileform
     $floor_no = $request->floorno;
     // get floor_no from profileform
     $profile->apartments()->attach($profile->defaultApartment, ['approved' => '1', 'block_no' => $block_no, 'floor_no' => $floor_no]);
     // attach this profile with default apartment, with approved = 1, and block_no, floor_no according to profileform in apartment_profile pivot table.
     Crm_account::create(['account' => $user->first_name . $user->last_name, 'fname' => $user->first_name, 'lname' => $user->last_name, 'company' => 'Company Name', 'email' => $user->email, 'address' => 'Current Address', 'city' => 'Nagpur', 'state' => 'Maharashtra', 'zip' => '440012', 'country' => 'India']);
     return redirect()->back()->withMessage('User has been Added')->withStatus('success');
 }
开发者ID:suchayj,项目名称:easymanage,代码行数:31,代码来源:AdduserController.php

示例5: rules

 /**
  * Get the validation rules that apply to the request.
  *
  * @return array
  */
 public function rules()
 {
     $validation['password'] = 'required|min:6|confirmed';
     $validation['current_password'] = 'required';
     $user = Auth::user();
     return $validation;
 }
开发者ID:mage2,项目名称:laravel-ecommerce,代码行数:12,代码来源:ChangePasswordRequest.php

示例6: update

 public function update()
 {
     $profile = Profile::where('user_id', Auth::user()->id)->first();
     $profile->fill(Input::all());
     $profile->save();
     return Redirect::to("/edit_profile");
 }
开发者ID:Volkan61,项目名称:begreat,代码行数:7,代码来源:ProfileController.php

示例7: validate

 /**
  * @param $credentials
  * @throws ValidationFailed
  */
 public function validate($credentials)
 {
     $valid = Auth::validate($credentials);
     if (!$valid) {
         throw new ValidationFailed();
     }
 }
开发者ID:RobbieBakker,项目名称:laravelstuff,代码行数:11,代码来源:User.php

示例8: boot

 /**
  * Boot Oci8 Provider
  */
 public function boot()
 {
     $this->publishes([__DIR__ . '/../config/oracle.php' => config_path('oracle.php')], 'oracle');
     Auth::provider('oracle', function ($app, array $config) {
         return new OracleUserProvider($app['hash'], $config['model']);
     });
 }
开发者ID:yajra,项目名称:laravel-oci8,代码行数:10,代码来源:Oci8ServiceProvider.php

示例9: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!Auth::check() || !Auth::user()->admPower) {
         return redirect()->route('paginaInicial');
     }
     return $next($request);
 }
开发者ID:EJCM,项目名称:rodalol,代码行数:14,代码来源:AdminMiddleware.php

示例10: callback

 public function callback(SocialAccountService $service, $provider)
 {
     $driver = Socialite::driver($provider);
     $user = $service->createOrGetUser($driver, $provider);
     Auth::login($user, true);
     return redirect()->intended('/');
 }
开发者ID:avil13,项目名称:lab.friends,代码行数:7,代码来源:SocialController.php

示例11: dashboard

 public function dashboard()
 {
     $messages = Redis::lrange('messages', 0, -1);
     $messages = $messages ? $messages : [];
     $tasks = Auth::user()->tasks()->get();
     return view('dashboard', compact('messages', 'tasks'));
 }
开发者ID:ColDog,项目名称:laravel-first,代码行数:7,代码来源:PagesController.php

示例12: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     if (Auth::check()) {
         return Redirect::to('/profile');
     }
     return View::make('user-package::registration.create');
 }
开发者ID:raymondidema,项目名称:user-package,代码行数:12,代码来源:RegistrationController.php

示例13: edit

 public function edit(Donations $donations)
 {
     if (!Auth::check()) {
         return redirect('donations');
     }
     return view('edit', compact('donations'));
 }
开发者ID:Tropuska,项目名称:DWA-seminar2,代码行数:7,代码来源:DonationsController.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (Auth::user()->id == 1) {
         return $next($request);
     }
     return redirect()->guest('login')->withErrors(trans('auth.admin'));
 }
开发者ID:timpressive,项目名称:art-auction,代码行数:15,代码来源:Administrator.php

示例15: postLogin

 /**
  * Process a login HTTP POST
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postLogin(Request $request)
 {
     //TODO
     // dd($request->all());
     //\Debugbar::info("Entra postlogin");
     //echo "prova";
     $this->validate($request, ['email' => 'required|email', 'password' => 'required']);
     //        if($this->login($request->email, $request->password)){
     //            //REDIRECT TO HOME
     //            //Session::set('authenticated',true);
     //
     //            return redirect()->route('auth.home');
     //        }else{
     //            $request->session()->flash('login_error', 'Login Incorrecte');
     //            return redirect()->route('auth.login');
     //            //REDIRECT BACK
     //        }
     if (Auth::attempt(['email' => $request->email, 'password' => $request->password])) {
         // Authentication passed...
         return redirect()->route('auth.home');
         //return redirect()->intended('auth.home');
     } else {
         return redirect()->route('auth.login');
     }
 }
开发者ID:OscarDuranX,项目名称:Auth,代码行数:30,代码来源:LoginController.php


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