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


PHP Http\Request类代码示例

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


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

示例1: notdone

 public function notdone(Request $request, DoneTask $task)
 {
     $request->user()->tasks()->create(['name' => $request->name]);
     $this->authorize('destroy', $task);
     $task->delete();
     return redirect('/tasks');
 }
开发者ID:rubends,项目名称:web-backend-oplossingen,代码行数:7,代码来源:TaskController.php

示例2: intlDomain

 public function intlDomain(Request $request)
 {
     $data = $request->all();
     $contacts = (object) $data['contacts'];
     //Registrant Contact Array
     $registrant = ['Firstname' => $contacts->Registrant_FirstName, 'Lastname' => $contacts->Registrant_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Registrant_CountryCode, 'City' => $contacts->Registrant_City, 'Email' => $contacts->Registrant_Email, 'Street' => $contacts->Registrant_Street, 'PostalCode' => $contacts->Registrant_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
     // Admin Contact Array
     $admin = ['Firstname' => $contacts->Admin_FirstName, 'Lastname' => $contacts->Admin_LastName, 'Organization' => 'My Company', 'CountryCode' => $contacts->Admin_CountryCode, 'City' => $contacts->Admin_City, 'Email' => $contacts->Admin_Email, 'Street' => $contacts->Admin_Street, 'PostalCode' => $contacts->Admin_PostalCode, 'PhoneNumber' => $this->intlphoneNumber($contacts->Registrant_PhoneNumber, $contacts->Registrant_CountryCode)];
     $c = array('Registrant' => $registrant, 'Admin' => $admin, 'Technical' => $admin, 'Billing' => $admin);
     $nameservers = ['Ns_list' => implode(',', $data['name_servers'])];
     try {
         InternetBS::init('X1A7S0D7X8N0U0U0I6S2', 'Toto197500cxz');
         if (Domain::find($data['domain_id'])->domain_status == 0) {
             $response = (object) json_decode(InternetBS::api()->domainCreate($data['domain_name'], $c, 1, $nameservers));
             if ($response->product[0]->status == 'SUCCESS') {
                 $domain = Domain::find($data->domain_id);
                 $domain->domain_status = 1;
                 $domain->save();
                 // Send an email of confirmation and do a redirection automatically
                 return redirect('admin/dashboard');
             } else {
                 // Redict to error page
                 return redirect('admin/errors');
             }
         } else {
             // Update Domain Name //
             InternetBS::api()->domainAssignNS($data['domain_name'], $data['name_servers']);
             $updates = InternetBS::api()->domainUpdate($data['domain_name'], $c);
             return ['response' => $updates];
         }
     } catch (Exception $e) {
         return ['response' => 'error detected', 'error_msg' => $e->getMessage()];
     }
 }
开发者ID:antonioiradukunda,项目名称:kplhosting,代码行数:34,代码来源:OrderController.php

示例3: doRegister

 public function doRegister(Request $request)
 {
     $validator = Validator::make($data = $request->all(), Admin::$rules, Admin::$messages);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     if ($validator->passes()) {
         $confirmation_code = Str::quickRandom(30);
         $admin = new Admin();
         $admin->fullname = ucwords($request->fullname);
         $admin->mobile_no = $request->mobile_no;
         $admin->email = $request->email;
         $admin->password = bcrypt($request->password);
         $admin->confirmation_code = $confirmation_code;
         $data = ['confirmation_code' => $confirmation_code, 'username' => $request->username, 'password' => $request->password, 'mobile_no' => $request->mobile_no];
         Basehelper::sendSMS($request->mobile_no, 'Hello ' . $request->username . ', you have successfully registere. Your username is ' . $request->username . ' and password is ' . $request->password);
         // Mail::send('emails.verify', $data, function($message) use ($admin, $data){
         // 	$message->from('no-reply@employment_bank', 'Employment Bank');
         //     	$message->to(Input::get('email'), $admin->name)
         //         	->subject('Verify your email address');
         // });
         if (!$admin->save()) {
             return Redirect::back()->with('message', 'Error while creating your account!<br> Please contact Technical Support');
         }
         return Redirect::route('admin.login')->with('message', 'Account has been created!<br>Now Check your email address to verify your account by checking your spam folder or inboxes for verification link after that you can login');
         //sendConfirmation() Will go the email and sms as needed
     } else {
         return Redirect::back()->withInput()->withErrors($validation);
         // ->with('message', 'There were validation errors.');
     }
 }
开发者ID:unicorn-softwares,项目名称:employment_bank,代码行数:31,代码来源:AdminHomeController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if (!$request->user()->isADoctor()) {
         return redirect('dash');
     }
     return $next($request);
 }
开发者ID:Remiah94,项目名称:clinicPlus,代码行数:14,代码来源:RedirectIfNotDoctor.php

示例5: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     if ($returnUrl = $request->input('return')) {
         $request->session()->put('url.intended', $returnUrl);
     }
     return $next($request);
 }
开发者ID:absent1706,项目名称:laravel-minihabr,代码行数:14,代码来源:RememberReturnUrl.php

示例6: 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

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $this->service->update($request->all());
     $file = File::find($this->service->file_id);
     $file->update(['name' => $request['file']]);
     return "Actualizado";
 }
开发者ID:NanoCodeInc,项目名称:Admin,代码行数:14,代码来源:ServiceController.php

示例8: unauthenticated

 /**
  * Convert an authentication exception into an unauthenticated response.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Illuminate\Auth\AuthenticationException  $exception
  * @return \Illuminate\Http\Response
  */
 protected function unauthenticated($request, AuthenticationException $exception)
 {
     if ($request->expectsJson()) {
         return response()->json(['error' => 'Unauthenticated.'], 401);
     }
     return redirect()->guest('login');
 }
开发者ID:hownowbrowncow,项目名称:website,代码行数:14,代码来源:Handler.php

示例9: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $hunt = $request->all();
     $hunt['user_id'] = Auth::user()->id;
     Hunt::create($hunt);
     return redirect('/home');
 }
开发者ID:SAEBelgradeWeb,项目名称:601-Fish,代码行数:13,代码来源:HuntsController.php

示例10: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $todo = auth()->user()->employee->todos()->create($request->all());
     if ($todo) {
         return $todo;
     }
 }
开发者ID:rosemalejohn,项目名称:dnsc-hris,代码行数:13,代码来源:TodoController.php

示例11: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $loggingIn = $request->is('api/v1/login') || $request->is('api/v1/register') || $request->is('api/v1/oauth_login');
     $headers = Utils::getApiHeaders();
     $hasApiSecret = false;
     if ($secret = env(API_SECRET)) {
         $requestSecret = Request::header('X-Ninja-Secret') ?: ($request->api_secret ?: '');
         $hasApiSecret = hash_equals($requestSecret, $secret);
     }
     if ($loggingIn) {
         // check API secret
         if (!$hasApiSecret) {
             sleep(ERROR_DELAY);
             return Response::json('Invalid value for API_SECRET', 403, $headers);
         }
     } else {
         // check for a valid token
         $token = AccountToken::where('token', '=', Request::header('X-Ninja-Token'))->first(['id', 'user_id']);
         // check if user is archived
         if ($token && $token->user) {
             Auth::onceUsingId($token->user_id);
             Session::set('token_id', $token->id);
         } else {
             sleep(ERROR_DELAY);
             return Response::json('Invalid token', 403, $headers);
         }
     }
     if (!Utils::isNinja() && !$loggingIn) {
         return $next($request);
     }
     if (!Utils::hasFeature(FEATURE_API) && !$hasApiSecret) {
         return Response::json('API requires pro plan', 403, $headers);
     } else {
         $key = Auth::check() ? Auth::user()->account->id : $request->getClientIp();
         // http://stackoverflow.com/questions/1375501/how-do-i-throttle-my-sites-api-users
         $hour = 60 * 60;
         $hour_limit = 100;
         # users are limited to 100 requests/hour
         $hour_throttle = Cache::get("hour_throttle:{$key}", null);
         $last_api_request = Cache::get("last_api_request:{$key}", 0);
         $last_api_diff = time() - $last_api_request;
         if (is_null($hour_throttle)) {
             $new_hour_throttle = 0;
         } else {
             $new_hour_throttle = $hour_throttle - $last_api_diff;
             $new_hour_throttle = $new_hour_throttle < 0 ? 0 : $new_hour_throttle;
             $new_hour_throttle += $hour / $hour_limit;
             $hour_hits_remaining = floor(($hour - $new_hour_throttle) * $hour_limit / $hour);
             $hour_hits_remaining = $hour_hits_remaining >= 0 ? $hour_hits_remaining : 0;
         }
         if ($new_hour_throttle > $hour) {
             $wait = ceil($new_hour_throttle - $hour);
             sleep(1);
             return Response::json("Please wait {$wait} second(s)", 403, $headers);
         }
         Cache::put("hour_throttle:{$key}", $new_hour_throttle, 10);
         Cache::put("last_api_request:{$key}", time(), 10);
     }
     return $next($request);
 }
开发者ID:hillelcoren,项目名称:invoice-ninja,代码行数:67,代码来源:ApiCheck.php

示例12: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id, Request $request)
 {
     //$this->validate($request, ['name' => 'required']); // Uncomment and modify if you need to validate any input.
     $questionstatus = Questionstatuses::findOrFail($id);
     $questionstatus->update($request->all());
     return redirect('questionstatus');
 }
开发者ID:abhatia2107,项目名称:cat,代码行数:13,代码来源:QuestionStatusController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     $evento = EventoModel::findOrFail($id);
     $input = $request->all();
     $evento->fill($input)->save();
     return redirect('/evento');
 }
开发者ID:brjipa,项目名称:InAgito,代码行数:14,代码来源:EventoController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(CookieJar $cookieJar, Request $request)
 {
     if ($request->isMethod('post')) {
         $supplier_email = $request->get('supplier_email');
         $supplier_password = $request->get('supplier_password');
         $checkAgentExists = Supplier::where("email", "=", $supplier_email);
         $checkAgentExists = $checkAgentExists->where("password", "=", md5($supplier_password . Config::get('constants.SITENAME')));
         $checkAgentExists = $checkAgentExists->get();
         if ($request->get('remember_login')) {
             $cookieJar->queue(Cookie::make('supplier_email', $supplier_email, 60));
             $cookieJar->queue(Cookie::make('supplier_password', $supplier_password, 60));
         } else {
             $cookieJar->queue(Cookie::forget('supplier_email'));
             $cookieJar->queue(Cookie::forget('supplier_password'));
         }
         if (count($checkAgentExists) > 0) {
             Session::put('SUPPLIER_ACCESS_ID', $checkAgentExists[0]->id);
             Session::put('SUPPLIER_ACCESS_FNAME', $checkAgentExists[0]->first_name);
             Session::put('SUPPLIER_ACCESS_LNAME', $checkAgentExists[0]->last_name);
             return redirect('supplier/dashboard');
         } else {
             return Redirect::route('supplier_land')->with('message', ['Invalid email address or/and password.']);
         }
     }
 }
开发者ID:kalyandey,项目名称:livingadventure,代码行数:31,代码来源:LoginController.php

示例15: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string $role
  * @return mixed
  */
 public function handle($request, Closure $next, $role)
 {
     if (!$request->user()->hasRole($role)) {
         return redirect()->back()->withErrors('msg', 'Not authorized');
     }
     return $next($request);
 }
开发者ID:NineWorldsKindred,项目名称:site,代码行数:15,代码来源:RoleMiddleware.php


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