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


PHP Route::getFacadeRoot方法代码示例

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


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

示例1: checkPermission

 public static function checkPermission()
 {
     $userInfo = Session::get('user');
     $uri = new Permission();
     $currentRoute = Route::getFacadeRoot()->current()->uri();
     if (Cache::has('user')) {
         $user = Cache::get('user');
         $permission = $user['permission'];
         $ck = in_array($userInfo['role_id'] . '|' . $currentRoute, $permission);
     } else {
         $ck = $uri->where('name', $userInfo['role_id'] . '|' . $currentRoute)->count();
     }
     if ($ck > 0 || $userInfo['role_id'] == 1) {
         return true;
     }
     return false;
 }
开发者ID:hungnt167,项目名称:CDShop,代码行数:17,代码来源:Authen.php

示例2: storeUserType

 public function storeUserType(Request $request)
 {
     $rules = ['name' => 'required|min:6', 'email' => 'required|email|unique:users', 'password' => 'required|confirmed|min:6', 'phone_number' => 'required', 'age' => 'required|numeric', 'gender' => 'required'];
     $messages = ['name.required' => 'Please Enter Your Name.', 'email.required' => 'Please Enter Email Address.', 'password.required' => 'Please enter your password', 'age.required' => 'Please enter your age', 'gender.required' => 'Please Check Your Gender', 'phone_number.required' => 'Please Enter Your Phone Number'];
     $validator = Validator::make($request->all(), $rules, $messages);
     if ($validator->fails()) {
         return Redirect::back()->withInput()->withErrors($validator);
     }
     $confirmation_code = str_random(30);
     //To get User Type
     $routeType = Route::getFacadeRoot()->current()->uri();
     if ($routeType == 'saveTeacherProfile') {
         $userType = 'teacher';
     } else {
         $userType = 'admin';
     }
     User::create(['name' => $request->input('name'), 'email' => $request->input('email'), 'gender' => $request->input('gender'), 'age' => $request->input('age'), 'password' => bcrypt($request->input['password']), 'confirmation_code' => $confirmation_code, 'phone_number' => $request->input('phone_number'), 'user_type' => $userType]);
     $data = array('confirmation_code' => $confirmation_code, 'name' => Input::get('name'));
     Mail::send('email.verify', $data, function ($message) {
         $message->to(Input::get('email'), Input::get('name'))->subject('Verify your email address');
     });
     Session::flash('success', 'Sir,Thanks for signing up! Please check your email.');
     return Redirect::to('student-registration');
 }
开发者ID:iqbaltiger,项目名称:laravel,代码行数:24,代码来源:RegistrationController.php

示例3: compose

 /**
  * Bind data to the view.
  *
  * @param \Illuminate\Contracts\View\View $view View object
  *
  * @return void
  */
 public function compose(\Illuminate\Contracts\View\View $view)
 {
     $view->with('currentRoute', $this->route->getFacadeRoot()->currentRouteName());
 }
开发者ID:anthemred,项目名称:my-assistant-soccer-coach,代码行数:11,代码来源:RouteComposer.php

示例4: getDefaultRoute

 /**
  * Get a default route value, if any is available
  *
  * @return Registrar|null A default route value or Null if no default value is available
  */
 public function getDefaultRoute()
 {
     return Route::getFacadeRoot();
 }
开发者ID:aedart,项目名称:laravel-helpers,代码行数:9,代码来源:RouteTrait.php

示例5: __construct

 public function __construct()
 {
     $this->router = \Illuminate\Support\Facades\Route::getFacadeRoot();
 }
开发者ID:garrinar,项目名称:laravel,代码行数:4,代码来源:Router.php

示例6: loginPost

 public function loginPost(Request $request)
 {
     //validate input
     $v = Validator::make($request->all(), ['email' => 'required|email', 'password' => 'required']);
     //recaptcha implementation
     //TODO after 5 attempt show recaptcha
     //$recaptcha = new \ReCaptcha\ReCaptcha(Setting::getSetting('recaptchasecret'));
     //$resp = $recaptcha->verify($_POST['g-recaptcha-response'], $_SERVER['REMOTE_ADDR']);
     if ($v->fails()) {
         $errors = $v->errors();
         $return['status'] = false;
         $return['errors'] = $errors;
     }
     $userdata = array('email' => $request->get('email'), 'password' => $request->get('password'));
     $remember = false;
     if ($request->has('remember_me') && $request->get('remember_me') == 1) {
         $remember = true;
     }
     if (Auth::attempt($userdata, $remember)) {
         $currentPath = Route::getFacadeRoot()->current()->uri();
         $return['status'] = true;
         $return['url'] = url($currentPath);
     } else {
         $return['status'] = false;
         $return['errors'] = ['general' => ['Please check your email and/or password or register']];
     }
     return $return;
 }
开发者ID:sordev,项目名称:bootup,代码行数:28,代码来源:UserController.php


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