本文整理汇总了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;
}
示例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");
}
示例3: __construct
public function __construct(VisitInterface $visitRepo, VisitMetaInterface $visitMetaRepo)
{
$this->visitRepo = $visitRepo;
$this->visitMetaRepo = $visitMetaRepo;
$this->request = Request::instance();
$this->config = Config::get('simplytics');
}
示例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');
}
示例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(), ''));
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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;
}
示例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'));
}
示例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]);
}
}
示例13: before
public function before(Person $person, $ability)
{
if ($person->isSuperuser() || Auth::check('managePages', Request::instance())) {
return true;
}
}
示例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());
}
示例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());
}