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


PHP Request::only方法代码示例

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


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

示例1: postReset

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postReset(Request $request)
 {
     $credentials = $request->only('email', 'password', 'password_confirmation');
     $response = Password::reset($credentials, function ($user, $password) {
         $this->resetPassword($user, $password);
     });
     switch ($response) {
         case Password::PASSWORD_RESET:
             return redirect($this->redirectPath());
         default:
             return redirect()->back()->withInput($request->only('email'))->withErrors(['email' => trans($response)]);
     }
 }
开发者ID:ampodobas,项目名称:uci-law-sba-outline-bank,代码行数:19,代码来源:PasswordController.php

示例2: signup

 public function signup()
 {
     $payment_settings = PaymentSetting::first();
     if ($payment_settings->live_mode) {
         User::setStripeKey($payment_settings->live_secret_key);
     } else {
         User::setStripeKey($payment_settings->test_secret_key);
     }
     $token = Input::get('stripeToken');
     $user_data = array('username' => Input::get('username'), 'email' => Input::get('email'), 'password' => Hash::make(Input::get('password')));
     $input = Input::all();
     unset($input['stripeToken']);
     $validation = Validator::make($input, User::$rules);
     if ($validation->fails()) {
         //echo $validation->messages();
         //print_r($validation->errors()); die();
         return Redirect::to('/signup')->with(array('note' => 'Sorry, there was an error creating your account.', 'note_type' => 'error', 'messages'))->withErrors($validation)->withInput(\Request::only('username', 'email'));
     }
     $user = new User($user_data);
     $user->save();
     try {
         $user->subscription('monthly')->create($token, ['email' => $user->email]);
         Auth::loginUsingId($user->id);
         return Redirect::to('/')->with(array('note' => 'Welcome! Your Account has been Successfully Created!', 'note_type' => 'success'));
     } catch (Exception $e) {
         Auth::logout();
         $user->delete();
         return Redirect::to('/signup')->with(array('note' => 'Sorry, there was an error with your card: ' . $e->getMessage(), 'note_type' => 'error'))->withInput(\Request::only('username', 'email'));
     }
 }
开发者ID:rinodung,项目名称:hello-video-laravel,代码行数:30,代码来源:ThemeAuthController.php

示例3: store

 /**
  * Start the creation of a new balance payment
  *   Details get posted into this method
  * @param $userId
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\FormValidationException
  * @throws \BB\Exceptions\NotImplementedException
  */
 public function store($userId)
 {
     $user = User::findWithPermission($userId);
     $this->bbCredit->setUserId($user->id);
     $requestData = \Request::only(['reason', 'amount', 'return_path', 'ref']);
     $amount = $requestData['amount'] * 1 / 100;
     $reason = $requestData['reason'];
     $returnPath = $requestData['return_path'];
     $ref = $requestData['ref'];
     //Can the users balance go below 0
     $minimumBalance = $this->bbCredit->acceptableNegativeBalance($reason);
     //What is the users balance
     $userBalance = $this->bbCredit->getBalance();
     //With this payment will the users balance go to low?
     if ($userBalance - $amount < $minimumBalance) {
         if (\Request::wantsJson()) {
             return \Response::json(['error' => 'You don\'t have the money for this'], 400);
         }
         \Notification::error("You don't have the money for this");
         return \Redirect::to($returnPath);
     }
     //Everything looks gooc, create the payment
     $this->paymentRepository->recordPayment($reason, $userId, 'balance', '', $amount, 'paid', 0, $ref);
     //Update the users cached balance
     $this->bbCredit->recalculate();
     if (\Request::wantsJson()) {
         return \Response::json(['message' => 'Payment made']);
     }
     \Notification::success("Payment made");
     return \Redirect::to($returnPath);
 }
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:39,代码来源:BalancePaymentController.php

示例4: login

 public function login()
 {
     $data = Request::only('email', 'password');
     $data['password'] = md5($data['password']);
     $rules = array('email' => 'required|email', 'password' => 'required|alphaNum|min:6');
     $validator = Validator::make($data, $rules);
     $result = array('errors' => '', 'result' => '');
     if ($validator->fails()) {
         $messages = $validator->messages();
         foreach ($messages->all() as $message) {
             $result['errors'] .= "<li>{$message}</li>";
         }
         return json_encode($result);
     }
     $user = new User();
     $response = $user->login($data);
     if ($response['status'] === true) {
         $sessionData = array();
         $sessionData['id'] = $response['id'];
         $sessionData['email'] = $response['email'];
         $result['result'] = 'success';
         Session::put('user_data', $sessionData);
     } else {
         $result['errors'] = 'Username or password incorrect. Please try again';
     }
     return json_encode($result);
 }
开发者ID:yousafmalik786,项目名称:shipping-crud,代码行数:27,代码来源:UserController.php

示例5: compose

 public function compose(View $view)
 {
     $documentForm = \Request::only('responsable_id');
     $route = Route::currentRouteName();
     $users = User::orderBy('name', 'ASC')->lists('name', 'id')->toArray();
     $view->with(compact('documentForm', 'users', 'route'));
 }
开发者ID:aguila302,项目名称:oficios,代码行数:7,代码来源:LoadUsers.php

示例6: store

 /**
  * Start the creation of a new gocardless payment
  *   Details get posted into this method and the redirected to gocardless
  * @param $userId
  * @throws \BB\Exceptions\AuthenticationException
  * @throws \BB\Exceptions\FormValidationException
  * @throws \BB\Exceptions\NotImplementedException
  */
 public function store($userId)
 {
     User::findWithPermission($userId);
     $requestData = \Request::only(['reason', 'amount', 'return_path', 'stripeToken', 'ref']);
     $stripeToken = $requestData['stripeToken'];
     $amount = $requestData['amount'];
     $reason = $requestData['reason'];
     $returnPath = $requestData['return_path'];
     $ref = $requestData['ref'];
     try {
         $charge = Stripe_Charge::create(array("amount" => $amount, "currency" => "gbp", "card" => $stripeToken, "description" => $reason));
     } catch (\Exception $e) {
         \Log::error($e);
         if (\Request::wantsJson()) {
             return \Response::json(['error' => 'There was an error confirming your payment'], 400);
         }
         \Notification::error("There was an error confirming your payment");
         return \Redirect::to($returnPath);
     }
     //Replace the amount with the one from the charge, this prevents issues with variable tempering
     $amount = $charge->amount / 100;
     //Stripe don't provide us with the fee so this should be OK
     $fee = $amount * 0.024 + 0.2;
     $this->paymentRepository->recordPayment($reason, $userId, 'stripe', $charge->id, $amount, 'paid', $fee, $ref);
     if (\Request::wantsJson()) {
         return \Response::json(['message' => 'Payment made']);
     }
     \Notification::success("Payment made");
     return \Redirect::to($returnPath);
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:38,代码来源:StripePaymentController.php

示例7: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $role = Role::findOrFail($id);
     $formData = \Request::only(['description', 'title', 'email_public', 'email_private', 'slack_channel']);
     $this->roleValidator->validate($formData);
     $role->update($formData);
     return \Redirect::back();
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:14,代码来源:RolesController.php

示例8: update

 public function update($proposalId)
 {
     $this->proposalValidator->validate(\Request::all(), $proposalId);
     $data = \Request::only('title', 'description', 'start_date', 'end_date');
     $this->proposalRepository->update($proposalId, $data);
     \Notification::success("Proposal updated");
     return \Redirect::route('proposals.index');
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:8,代码来源:ProposalController.php

示例9: block

 /**
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function block($id)
 {
     $shop = Shops::find($id);
     $input = \Request::only('blocked')['blocked'];
     $shop->blocked = $input;
     $shop->update();
     return redirect()->route('admin.shops.index');
 }
开发者ID:lyovkin,项目名称:v2board,代码行数:12,代码来源:AdminShopsController.php

示例10: store

 public function store()
 {
     $this->feedbackValidator->validate(\Request::only('comments'));
     $memberName = \Auth::user()->name;
     \Mail::queue('emails.feedback', ['memberName' => $memberName, 'comments' => \Request::get('comments')], function ($message) {
         $message->to('arthur@arthurguy.co.uk', 'Arthur Guy')->subject('BBMS Feedback');
     });
     return \Response::json(['success' => 1]);
 }
开发者ID:adamstrawson,项目名称:BBMembershipSystem,代码行数:9,代码来源:FeedbackController.php

示例11: store

 public function store()
 {
     $data = new Kadis();
     dd(Request::only('title', 'zaki'));
     if ($data->fill([])->save()) {
         return redirect()->route('kadis.index');
     }
     return route('kadis.index');
 }
开发者ID:triasbrata,项目名称:webEnterprise,代码行数:9,代码来源:KadisController.php

示例12: reauth

 /**
  * Handle the reauthentication request to the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Orchestra\Foundation\Validation\Account  $validator
  *
  * @return mixed
  */
 public function reauth(Request $request, AccountValidator $validator)
 {
     $validation = $validator->on('reauthenticate')->with($request->only(['password']));
     if ($validation->fails()) {
         return $this->userReauthenticateHasFailedValidation($validation->getMessageBag());
     } elseif (!(new ReauthLimiter($request))->attempt($request->input('password'))) {
         return $this->userHasFailedReauthentication();
     }
     return $this->userHasReauthenticated();
 }
开发者ID:quetzyg,项目名称:foundation,代码行数:18,代码来源:ReauthenticateController.php

示例13: in

 public function in()
 {
     $credentials = \Request::only('email', 'password');
     if ($token = \JWTAuth::attempt($credentials)) {
         $response = response()->json(['token' => $token]);
     } else {
         $response = response()->json(['errors' => ['The email/password is invalid.']], 400);
     }
     return $response;
 }
开发者ID:disik69,项目名称:backend.english-roulette-v0.3,代码行数:10,代码来源:SignController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store($roleId)
 {
     $formData = \Request::only(['user_id']);
     $this->roleUserValidator->validate($formData);
     $role = Role::findOrFail($roleId);
     //If the user isnt already a member add them
     if (!$role->users()->get()->contains($formData['user_id'])) {
         $role->users()->attach($formData['user_id']);
     }
     return \Redirect::back();
 }
开发者ID:paters936,项目名称:BBMembershipSystem,代码行数:16,代码来源:RoleUsersController.php

示例15: postLogin

 public function postLogin()
 {
     $credentials = Request::only('email', 'password');
     $validator = Validator::make($credentials, ['email' => 'required|email', 'password' => 'required']);
     if ($validator->valid()) {
         if (Auth::attempt($credentials)) {
             return Redirect::intended('/');
         }
     }
     return Redirect::to('auth/login')->withInput(Request::only('email'))->withErrors(['email' => 'Invalid credentials']);
 }
开发者ID:resulaslan,项目名称:sample-l4-app,代码行数:11,代码来源:AuthController.php


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