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


PHP Request::only方法代码示例

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


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

示例1: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $info = $request->only(['detail', 'total_atentions']);
     $detail = $info['detail'];
     $input = $request->only(['patient_id', 'medic_id', 'total_atentions']);
     $patient = Patient::find($input['patient_id']);
     $discount = $patient->discount($input['total_atentions']);
     $total = $input['total_atentions'] - $discount;
     $input['total'] = $total;
     $input['discount'] = $discount;
     $input['company_id'] = $patient->Company->id;
     $input['status'] = "Pendiente";
     $input['user_id'] = $request->user()->id;
     $rules = ['patient_id' => 'required', 'medic_id' => 'required', 'total_atentions' => 'required'];
     $validation = \Validator::make($input, $rules);
     if ($validation->passes()) {
         //
         $budget = new Budget($input);
         $budget->save();
         $json = json_decode($detail);
         //return $json;
         foreach ($json as $key => $value) {
             $data_detail = ["price" => $value->valor, "budget_id" => $budget->id, "atention_id" => $value->id];
             //return $value->valor;
             $budgetDetail = new BudgetDetail($data_detail);
             $budgetDetail->save();
         }
         $respuesta = "Guardado";
         $numero = $budget->id;
         return response()->json(compact('respuesta', 'numero'));
     }
     $messages = $validation->errors();
     return response()->json($messages);
 }
开发者ID:L0rdKras,项目名称:the_clinic,代码行数:40,代码来源:BudgetController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request, ApiService $apiService)
 {
     /*
     Do some basic validation beause the form is a perfect representation of the resource on the api side.
     TODO, might want to move this into the a WWW service layer if it gets out of hand? (can it be tested well here?)
     */
     $validator = Validator::make($request->all(), ['name' => 'required', 'msw_country' => 'required'], ['msw_country.required' => 'Please select the location']);
     if ($validator->fails()) {
         return redirect(route('spot.create'))->withErrors($validator)->withInput();
     }
     /** **/
     $response = $apiService->post(route('api.v1.0.spot.store'), $request->only(['msw_spot_id', 'name', 'public']))->addHeader(['Authorization' => 'Bearer ' . $request->cookie('token')])->dispatch();
     if ($response->getStatusCode() === 200) {
         //update the user's country as a convenience
         $payload = json_decode(base64_decode(explode('.', $request->cookie('token'))[1]));
         //this gets the JWT payload. Can be faked by the user, but the API server side will be validating the request
         $apiService->patch(route('api.v1.0.user.update', $payload->sub), $request->only('msw_country'))->addHeader(['Authorization' => 'Bearer ' . $request->cookie('token')])->dispatch();
         return redirect(route($request->get('from_route') ?: 'dashboard'));
     } else {
         if ($response->getStatusCode() === 400) {
             $content = $response->getContent();
             return redirect(route('spot.create'))->withErrors((array) $content->errors)->withInput();
         } else {
             if ($response->getStatusCode() === 403) {
                 return redirect(route('login'))->withErrors(['generic' => ['Your session has expired, please login again']]);
             } else {
                 return redirect(route('spot.create'))->withErrors(['generic' => ['There was a problem with the system, please try again']])->withInput();
             }
         }
     }
 }
开发者ID:shauno,项目名称:sesh.co.za,代码行数:37,代码来源:SpotController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $vDatos = Validator::make($request->all(), ['tiempo_experiencia' => 'required|numeric', 'referencia_anterior' => 'required']);
     $v = Validator::make($request->all(), ['codigo' => 'required|size:8']);
     if ($v->fails()) {
         return redirect('profesor/create')->withErrors($v->errors())->withInput($request->only('codigo'));
     }
     //validar existencia
     $res = $personaService->verificarExistencia($request->get('codigo'));
     //        if($res->profesor==null){
     //            return 'registre solo profesor';
     //        }
     //        if($res->profesor){
     //            return 'nd';
     //
     //        }
     //si lo tengo como perosno pero profesor
     //si t persona y preofeosr no puedo insertar
     if ($res == null) {
         //codigo no encontrado
         return redirect('persona/create')->withErrors($v->errors())->withInput($request->only('codigo'))->with('message', 'DNI no encontrado');
     } else {
         if ($vDatos->fails()) {
             //  dd($request->all());
             return redirect()->back()->withErrors($vDatos->errors())->withInput($request->only('codigo'))->with('esPersona', 'true');
         } else {
             //ProfesorService::registrar($request->all(),$res->id);
             dd($request->all());
             ProfesorService::registrar($request->all());
             return redirect('profesor/create')->withErrors($v->errors())->with('message', 'Profesor Registrado');
         }
     }
 }
开发者ID:examonline,项目名称:matriculaApp,代码行数:38,代码来源:ProfesorController.php

示例4: show

 public function show(Request $request)
 {
     if (!$request->get('email')) {
         // we notify the current user
         Modal::alert([trans('validation.required', ['attribute' => trans('validation.attributes.email')])], 'error');
         return redirect()->route('password.index');
     }
     // we get the user
     if (!($user = Sentinel::findUserByCredentials($request->only('email')))) {
         // we notify the current user
         Modal::alert([trans('auth.message.find.failure', ['email' => $request->get('email')])], 'error');
         return redirect()->route('password.index');
     }
     // we verify that the reminder token is valid
     if (!Reminder::exists($user, $request->only('token'))) {
         // notify the user & redirect
         Modal::alert([trans('auth.message.password_reset.token.expired')], 'error');
         return redirect(route('password.index'));
     }
     // SEO settings
     $this->seo_meta['page_title'] = trans('seo.front.password.show.title');
     $this->seo_meta['meta_desc'] = trans('seo.front.password.show.description');
     $this->seo_meta['meta_keywords'] = trans('seo.front.password.show.keywords');
     // data send to the view
     $data = ['email' => $request->get('email'), 'reminder' => $request->get('token'), 'seo_meta' => $this->seo_meta, 'css' => elixir('css/app.auth.css')];
     return view('pages.front.password-reset')->with($data);
 }
开发者ID:Okipa,项目名称:una.app,代码行数:27,代码来源:PasswordController.php

示例5: login

 public function login(Request $request)
 {
     $validator = Validator::make($request->only('email', 'password'), $this->user->login_rules);
     if ($validator->passes()) {
         if (auth()->attempt($request->only('email', 'password'))) {
             $user = auth()->user();
             //$start_date = new DateTime('-1 year');
             //$end_date = new DateTime;
             if (date("m") <= 8) {
                 $current_year = date("Y") - 1;
             } else {
                 $current_year = date("Y");
             }
             $start_date = Carbon::create($current_year, 9, 1, 0, 0, 0);
             $end_date = Carbon::now()->endOfDay();
             session()->put('start_date', $start_date);
             session()->put('end_date', $end_date);
             return redirect()->route('home');
             //return view()->make('home', compact('user'))->with('success', 'You are now Logged in');
         } else {
             return redirect()->back()->with('error', 'Login Failed')->withInput();
         }
     } else {
         return redirect()->back()->withInput()->withErrors($validator->messages());
     }
 }
开发者ID:mikeminckler,项目名称:unilog,代码行数:26,代码来源:SessionsController.php

示例6: authenticate

 /**
  * Handle a login request to the application.
  *
  */
 public function authenticate(Request $request)
 {
     $credentials = $request->only('username', 'password');
     if (Auth::attempt($credentials)) {
         return redirect()->intended('/');
     }
     return redirect('/login')->withInput($request->only('username'))->withErrors(['username' => 'El código no se encuentra registrado.']);
 }
开发者ID:armandolazarte,项目名称:guia,代码行数:12,代码来源:GuiaAuthController.php

示例7: update

 public function update($id)
 {
     $this->validate($this->request);
     $response = $this->copy->updateForSlug($id, $this->request->only('value'));
     if ($response) {
         return redirect()->route('admin.copy.index')->with('success', 'Copy updated successfully.');
     }
 }
开发者ID:rtablada,项目名称:student-grading,代码行数:8,代码来源:CopyController.php

示例8: handle

 /**
  * Execute the job.
  *
  */
 public function handle()
 {
     $this->validate($this->request, ['message' => 'string|required'], ['required' => 'o campo :attribute é obrigatório']);
     $postit = new PostIt($this->request->only('message') + ['status' => 10]);
     $postit->identifier()->associate($this->identifier);
     $postit->save();
     return $postit;
 }
开发者ID:codeforpg,项目名称:PostIt,代码行数:12,代码来源:StorePostIt.php

示例9: postLogin

 /**
  * Handle a login request to the application.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function postLogin(Request $request)
 {
     $credentials = $request->only('email', 'password');
     if (Auth::attempt($credentials, $request->has('remember'))) {
         return redirect()->intended('/admin/index');
     }
     return redirect('/login')->withInput($request->only('email', 'remember'))->withErrors(['email' => 'These credentials do not match our records.']);
 }
开发者ID:kpaxer,项目名称:laravel-blog,代码行数:15,代码来源:AuthController.php

示例10: store

 /**
  * Handle a login request to the application.
  *
  * @return \Illuminate\Http\Response
  */
 public function store()
 {
     $this->validate($this->request);
     $credentials = $this->request->only('email', 'password');
     if ($this->auth->attempt($credentials, $this->request->has('remember'))) {
         return redirect()->intended(route('admin.dashboard.index'))->with('success', 'You have logged in.');
     }
     return redirect()->route('auth.session.create')->with('danger', 'These credentials do not match our records.')->withInput($this->request->only('email'));
 }
开发者ID:rtablada,项目名称:student-grading,代码行数:14,代码来源:SessionController.php

示例11: authenticate

 public function authenticate(Request $request, $remember, $field)
 {
     if (Auth::user()->attempt($request->only($field, 'password'), $remember)) {
         return 'user';
     }
     if (Auth::customer()->attempt($request->only($field, 'password'), $remember)) {
         return 'customer';
     }
 }
开发者ID:borislemke,项目名称:kbr,代码行数:9,代码来源:AuthController.php

示例12: updateCurrent

 public function updateCurrent()
 {
     $user = $this->guard->user();
     $this->validate($this->request);
     $user = $this->user->update($user->id, $this->request->only('email', 'name'));
     if ($user) {
         return redirect()->route('admin.dashboard.index')->with('success', 'Profile updated successfully.');
     }
 }
开发者ID:rtablada,项目名称:student-grading,代码行数:9,代码来源:UsersController.php

示例13: update

 public function update($id, Request $request)
 {
     $tbn = TabelaSimplesNacional::where('id', '=', $id)->first();
     if ($tbn->validate($request->only('descricao'))) {
         $tbn->update($request->only('descricao'));
         return redirect(route('listar-simples-nacional'));
     } else {
         return redirect(route('editar-simples-nacional'))->withInput()->withErrors($tbn->errors());
     }
 }
开发者ID:basalbr,项目名称:fvm,代码行数:10,代码来源:SimplesNacionalController.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     $validador = Validator::make($request->all(), ['codigo' => 'required', 'nombre' => 'required', 'apePa' => 'required', 'apeMa' => 'required', 'telefono' => 'required|numeric', 'correo' => 'required|email', 'direccion' => 'required']);
     if ($validador->fails()) {
         return redirect('persona/create')->withErrors($validador->errors())->withInput($request->only('codigo'));
     }
     //se registra la persona
     $this->personaService->registrar($request->all());
     return redirect('profesor/create')->with('message', 'Persona Registrado')->with('esPersona', 'true')->withInput($request->only('codigo'));
 }
开发者ID:examonline,项目名称:matriculaApp,代码行数:15,代码来源:PersonaController.php

示例15: update

 public function update($id, Request $request)
 {
     $tipo_tributacao = TipoTributacao::where('id', '=', $id)->first();
     if ($tipo_tributacao->validate($request->only('descricao', 'has_tabela'))) {
         $tipo_tributacao->update($request->only('descricao', 'has_tabela'));
         return redirect(route('listar-tipo-tributacao'));
     } else {
         return redirect(route('editar-tipo-tributacao'))->withInput()->withErrors($tipo_tributacao->errors());
     }
 }
开发者ID:basalbr,项目名称:fvm,代码行数:10,代码来源:TipoTributacaoController.php


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