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


PHP Request::instance方法代码示例

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


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

示例1: create

 /**
  * Creates the view object for the HTML client.
  *
  * @param \Aimeos\MW\Config\Iface $config Configuration object
  * @param array $templatePaths List of base path names with relative template paths as key/value pairs
  * @param string|null $locale Code of the current language or null for no translation
  * @return \Aimeos\MW\View\Iface View object
  */
 public function create(\Aimeos\MW\Config\Iface $config, array $templatePaths, $locale = null)
 {
     $params = $fixed = array();
     if ($locale !== null) {
         $params = Route::current()->parameters() + Input::all();
         $fixed = $this->getFixedParams();
         $i18n = app('\\Aimeos\\Shop\\Base\\I18n')->get(array($locale));
         $translation = $i18n[$locale];
     } else {
         $translation = new \Aimeos\MW\Translation\None('en');
     }
     $view = new \Aimeos\MW\View\Standard($templatePaths);
     $helper = new \Aimeos\MW\View\Helper\Translate\Standard($view, $translation);
     $view->addHelper('translate', $helper);
     $helper = new \Aimeos\MW\View\Helper\Url\Laravel5($view, app('url'), $fixed);
     $view->addHelper('url', $helper);
     $helper = new \Aimeos\MW\View\Helper\Param\Standard($view, $params);
     $view->addHelper('param', $helper);
     $helper = new \Aimeos\MW\View\Helper\Config\Standard($view, $config);
     $view->addHelper('config', $helper);
     $sepDec = $config->get('client/html/common/format/seperatorDecimal', '.');
     $sep1000 = $config->get('client/html/common/format/seperator1000', ' ');
     $helper = new \Aimeos\MW\View\Helper\Number\Standard($view, $sepDec, $sep1000);
     $view->addHelper('number', $helper);
     $helper = new \Aimeos\MW\View\Helper\Request\Laravel5($view, Request::instance());
     $view->addHelper('request', $helper);
     $helper = new \Aimeos\MW\View\Helper\Csrf\Standard($view, '_token', csrf_token());
     $view->addHelper('csrf', $helper);
     return $view;
 }
开发者ID:dhaval48,项目名称:aimeos-laravel,代码行数:38,代码来源:View.php

示例2: postRegister

 public function postRegister()
 {
     $request = Request::instance();
     $request->setTrustedProxies(array('192.0.0.1', '10.0.0.0/8', '127.0.0.1'));
     if ($request->has("email")) {
         $requestData = $request->all();
         $rules = array("email" => "required|max:255|email");
         $validator = Validator::make($requestData, $rules);
         if ($validator->fails()) {
             return redirect("/")->withErrors(array("Dit is geen correct e-mail adres."));
         } else {
             $email = $request->input("email");
             $verificationCode = md5(uniqid(rand(), true));
             DB::table("contestants")->insert(array("email" => $email, "verification_code" => $verificationCode, "verification_received" => false, "ip_address" => $request->getClientIp()));
             $url = URL::action("HomeController@handleVerification", array("verify" => $verificationCode, "email" => $email));
             $emailData = array("url" => $url);
             Mail::send("email.email", $emailData, function ($message) use($email) {
                 $message->from("noreply@laravelcontest.com", "Laravel Contest");
                 $message->subject("Deelname wedstrijd!");
                 $message->to($email);
             });
             $data = array("email" => $email);
             return view("register.success", $data);
         }
         //Captcha
     }
     return redirect()->action("HomeController@getRegister");
 }
开发者ID:BennoDev,项目名称:WebDevelopment,代码行数:28,代码来源:HomeController.php

示例3: __construct

 public function __construct(VisitInterface $visitRepo, VisitMetaInterface $visitMetaRepo)
 {
     $this->visitRepo = $visitRepo;
     $this->visitMetaRepo = $visitMetaRepo;
     $this->request = Request::instance();
     $this->config = Config::get('simplytics');
 }
开发者ID:nem-c,项目名称:simplytics,代码行数:7,代码来源:StoreService.php

示例4: postLogin

 /**
  * Logs the user in.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postLogin()
 {
     if (Auth::attempt(Binput::only(['email', 'password']))) {
         return Redirect::intended('dashboard');
     }
     Throttle::hit(Request::instance(), 10, 10);
     return Redirect::back()->withInput(Binput::except('password'))->with('error', 'Invalid email or password');
 }
开发者ID:baa-archieve,项目名称:Cachet,代码行数:13,代码来源:AuthController.php

示例5: testBeforeReturnsTrueIfTheyCanManagePages

 public function testBeforeReturnsTrueIfTheyCanManagePages()
 {
     Auth::shouldReceive('check')->once()->with('managePages', Request::instance())->andReturn(true);
     Auth::shouldReceive('check')->once()->with('managePages', Request::instance())->andReturn(false);
     $policy = new PagePolicy();
     $this->assertTrue($policy->before(new Person(), ''));
     $this->assertNull($policy->before(new Person(), ''));
 }
开发者ID:imanghafoori1,项目名称:boom-core,代码行数:8,代码来源:PagePolicyTest.php

示例6: getComponents

 /**
  * Get all components.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getComponents()
 {
     if (app(Guard::class)->check()) {
         $components = Component::whereRaw('1 = 1');
     } else {
         $components = Component::enabled();
     }
     return $this->paginator($components->paginate(Binput::get('per_page', 20)), Request::instance());
 }
开发者ID:mohitsethi,项目名称:Cachet,代码行数:14,代码来源:ComponentController.php

示例7: getGroups

 /**
  * Get all groups.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getGroups()
 {
     $groups = ComponentGroup::query();
     $groups->search(Binput::except(['sort', 'order', 'per_page']));
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $groups->sort($sortBy, $direction);
     }
     $groups = $groups->paginate(Binput::get('per_page', 20));
     return $this->paginator($groups, Request::instance());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:16,代码来源:ComponentGroupController.php

示例8: getIncidents

 /**
  * Get all incidents.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getIncidents()
 {
     $incidentVisibility = app(Guard::class)->check() ? 0 : 1;
     $incidents = Incident::where('visible', '>=', $incidentVisibility);
     $incidents->search(Binput::except(['sort', 'order', 'per_page']));
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $incidents->sort($sortBy, $direction);
     }
     $incidents = $incidents->paginate(Binput::get('per_page', 20));
     return $this->paginator($incidents, Request::instance());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:17,代码来源:IncidentController.php

示例9: getComponents

 /**
  * Get all components.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getComponents()
 {
     if (app(Guard::class)->check()) {
         $components = Component::whereRaw('1 = 1');
     } else {
         $components = Component::enabled();
     }
     $components->search(Binput::except(['sort', 'order', 'per_page']));
     if ($sortBy = Binput::get('sort')) {
         $direction = Binput::has('order') && Binput::get('order') == 'desc';
         $components->sort($sortBy, $direction);
     }
     $components = $components->paginate(Binput::get('per_page', 20));
     return $this->paginator($components, Request::instance());
 }
开发者ID:uwm-appbrewery,项目名称:Cachet,代码行数:20,代码来源:ComponentController.php

示例10: items

 public static function items()
 {
     $items = Config::get('boomcms.menu');
     foreach ($items as $key => $item) {
         if (isset($item['role']) && !Auth::check($item['role'], Request::instance())) {
             unset($items[$key]);
             continue;
         }
         $items[$key]['title'] = isset($item['title']) ? $item['title'] : Lang::get('boomcms::menu.' . $key);
     }
     usort($items, function ($a, $b) {
         if ($a['title'] === $b['title']) {
             return 0;
         }
         return $a['title'] < $b['title'] ? -1 : 1;
     });
     return $items;
 }
开发者ID:imanghafoori1,项目名称:boom-core,代码行数:18,代码来源:Menu.php

示例11: postLogin

 /**
  * Logs the user in.
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postLogin()
 {
     $loginData = Binput::only(['email', 'password']);
     // Validate login credentials.
     if (Auth::validate($loginData)) {
         // Log the user in for one request.
         Auth::once($loginData);
         // Do we have Two Factor Auth enabled?
         if (Auth::user()->hasTwoFactor) {
             // Temporarily store the user.
             Session::put('2fa_id', Auth::user()->id);
             return Redirect::route('two-factor');
         }
         // We probably want to add support for "Remember me" here.
         Auth::attempt(Binput::only(['email', 'password']));
         return Redirect::intended('dashboard');
     }
     Throttle::hit(Request::instance(), 10, 10);
     return Redirect::back()->withInput(Binput::except('password'))->with('error', trans('forms.login.invalid'));
 }
开发者ID:n0mer,项目名称:Cachet,代码行数:25,代码来源:AuthController.php

示例12: verificaEmail

 public function verificaEmail(Request $request)
 {
     // Recebe o parametro email
     $request = Request::instance();
     $inputRequest = json_decode($request->getContent(), true);
     $email = $inputRequest['value'];
     $user = User::where('email', $email)->first();
     if ($user === null) {
         return response()->json(['isValid' => true, 'email' => $email]);
     } else {
         return response()->json(['isValid' => false, 'email' => $email]);
     }
 }
开发者ID:marcosdefontes,项目名称:diakonia,代码行数:13,代码来源:UsuarioController.php

示例13: before

 public function before(Person $person, $ability)
 {
     if ($person->isSuperuser() || Auth::check('managePages', Request::instance())) {
         return true;
     }
 }
开发者ID:imanghafoori1,项目名称:boom-core,代码行数:6,代码来源:PagePolicy.php

示例14: getMetricPoints

 /**
  * Get all metric points.
  *
  * @param \CachetHQ\Cachet\Models\Metric $metric
  *
  * @return \Illuminate\Database\Eloquent\Collection
  */
 public function getMetricPoints(Metric $metric)
 {
     $points = $metric->points()->paginate(Binput::get('per_page', 20));
     return $this->paginator($points, Request::instance());
 }
开发者ID:aksalj,项目名称:Cachet,代码行数:12,代码来源:MetricController.php

示例15: getGroups

 /**
  * Get all groups.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function getGroups()
 {
     $groups = ComponentGroup::paginate(Binput::get('per_page', 20));
     return $this->paginator($groups, Request::instance());
 }
开发者ID:reginaldojunior,项目名称:Cachet,代码行数:10,代码来源:ComponentGroupController.php


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