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


PHP Request::input方法代码示例

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


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

示例1: find

 /**
  * Find By longitude latitude
  * @param  Request $request [description]
  * @return Hexcores\Api\Facades\Response
  */
 public function find(Request $request)
 {
     $lat = (double) $request->input('lat');
     $long = (double) $request->input('lon');
     $data = $this->transform($this->model->findIntersects($long, $lat), new GeoTransformer(), true);
     return response_ok($data);
 }
开发者ID:GreenHackers,项目名称:geo-endpoint,代码行数:12,代码来源:LowerHouseController.php

示例2: updateArticle

 public function updateArticle(Request $request, $id)
 {
     $article->title = $request->input('title');
     $article->content = $request->input('content');
     $article->save();
     return response()->json($article);
 }
开发者ID:rahul-8590,项目名称:lumenAngular,代码行数:7,代码来源:ArticleController.php

示例3: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(Request $request)
 {
     // error_log("------------------------------------------------------");
     $Mailer = new Email();
     $Mailer->email = $request['email'];
     /* $validator class with method fails() */
     $validator = Validator::make($request->all(), ['email' => 'required|email']);
     /* $isNewEmail =
                true: no email found in db
                false: duplicate email found in db
        */
     $isNewEmail = collect($Mailer->where('email', $Mailer->email)->get())->isEmpty() ? true : false;
     if ($validator->fails()) {
         error_log(json_encode(['error' => ['invalid_email' => $request->all()]]));
         return response()->json(['error' => 'E-mail is invalid'])->setCallback($request->input('callback'));
     } elseif (!$isNewEmail) {
         error_log(json_encode(['error' => ['duplicate_email' => $request->all()]]));
         return response()->json(['error' => 'E-mail is marked as being subscribed'])->setCallback($request->input('callback'));
         return redirect('/')->withErrors($validator)->withInput();
     } else {
         error_log(json_encode(['mailer' => ['newEmail' => $Mailer]]));
         // soon
         $Scribe = $this->subscribe($Mailer->email);
         // soon
         error_log(json_encode(['scribe' => $Scribe]));
         $Mailer->save();
         return response()->json(['success' => true])->setCallback($request->input('callback'));
     }
 }
开发者ID:bostonmeshnet,项目名称:website,代码行数:34,代码来源:EmailController.php

示例4: campagne

 /**
  * Send campagne
  *
  * @return \Illuminate\Http\Response
  */
 public function campagne(Request $request)
 {
     // Get campagne
     $campagne = $this->campagne->find($request->input('id'));
     $date = $request->input('date', null);
     //set or update html
     $html = $this->worker->html($campagne->id);
     $this->mailjet->setList($campagne->newsletter->list_id);
     // list id
     // Sync html content to api service and send to newsletter list!
     $response = $this->mailjet->setHtml($html, $campagne->api_campagne_id);
     if (!$response) {
         throw new \designpond\newsletter\Exceptions\CampagneUpdateException('Problème avec la préparation du contenu');
     }
     /*
      *  Send at specified date or delay for 15 minutes before sending just in case
      */
     $toSend = $date ? \Carbon\Carbon::parse($date) : \Carbon\Carbon::now()->addMinutes(15);
     $result = $this->mailjet->sendCampagne($campagne->api_campagne_id, $toSend->toIso8601String());
     if (!$result['success']) {
         throw new \designpond\newsletter\Exceptions\CampagneSendException('Problème avec l\'envoi' . $result['info']['ErrorMessage'] . '; Code: ' . $result['info']['StatusCode']);
     }
     // Update campagne status
     $this->campagne->update(['id' => $campagne->id, 'status' => 'envoyé', 'updated_at' => date('Y-m-d G:i:s'), 'send_at' => $toSend]);
     alert()->success('Campagne envoyé!');
     return redirect('build/newsletter');
 }
开发者ID:designpond,项目名称:newsletter,代码行数:32,代码来源:SendController.php

示例5: update

 public function update(ServiceMonth $service_month, Request $request)
 {
     $input['hours_used'] = $request->input('hours_logged');
     $input['description'] = $request->input('description');
     $service_month->update($input);
     return $service_month->toJson();
 }
开发者ID:rtmatt,项目名称:rtclientmanager,代码行数:7,代码来源:ServiceMonthController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $rules = ['username' => 'required', 'password' => 'required', 'age' => 'required|integer'];
     try {
         $user = User::find($id);
         if (!$user) {
             return response()->json(['code' => 404, 'messages' => 'User not found.'], 404);
         }
         $username = $request->input('username');
         $password = $request->input('password');
         $age = $request->input('age');
         if ($username) {
             $user->username = $username;
         }
         if ($password) {
             $user->password = $password;
         }
         if ($age) {
             $user->age = (int) $age;
         }
         $validator = Validator::make($request->all(), $rules);
         if ($validator->fails()) {
             return response()->json(['code' => 422, 'messages' => $validator->errors()->all()], 422);
         }
         if ($age < 18) {
             return response()->json(['code' => 422, 'messages' => 'Age field must be greater than 18'], 422);
         }
         $user->save();
         return response()->json(['code' => 200, 'data' => $user], 200);
     } catch (Exception $e) {
         return response()->json(['code' => 500, 'messages' => 'Internal Server Error'], 500);
     }
 }
开发者ID:abarazarte,项目名称:phpTest1,代码行数:39,代码来源:UserController.php

示例7: doAddInvoice

 public function doAddInvoice(Request $request)
 {
     $invoice = Invoice::addNew($request->input('description'), $request->input('total_cost'));
     $invoice->attachToLabWork($request->input('lab_work_id'));
     $invoice->addInvoiceFile($request->file('invoice_file'));
     return redirect()->to('lab-work')->with('invoice-added');
 }
开发者ID:VoodooPrawn,项目名称:finest,代码行数:7,代码来源:InvoiceController.php

示例8: postChangePassword

 public function postChangePassword()
 {
     $newPassword = $this->request->input('password');
     $token = $this->request->input('spToken');
     $validator = $this->loginValidator();
     if ($validator->fails()) {
         if ($this->request->wantsJson()) {
             return $this->respondWithError('Validation Failed', 400, ['validatonErrors' => $validator->errors()]);
         }
         return redirect()->to(config('stormpath.web.changePassword.uri') . '?spToken=' . $token)->withErrors($validator);
     }
     $application = app('stormpath.application');
     try {
         $application->resetPassword($token, $newPassword);
         // the password has been changed. Time to fire the
         // `UserHasResetPassword` event
         //
         Event::fire(new UserHasResetPassword());
         if ($this->request->wantsJson()) {
             return $this->respondOk();
         }
         return redirect()->to(config('stormpath.web.changePassword.nextUri'));
     } catch (\Stormpath\Resource\ResourceError $re) {
         if ($this->request->wantsJson()) {
             return $this->respondWithError($re->getMessage(), $re->getStatus());
         }
         return redirect()->to(config('stormpath.web.changePassword.errorUri'))->withErrors(['errors' => [$re->getMessage()]]);
     }
 }
开发者ID:stormpath,项目名称:stormpath-laravel,代码行数:29,代码来源:ChangePasswordController.php

示例9: addHelp

 public function addHelp(Request $request, $id)
 {
     $event = Event::findOrFail($id);
     if (!$event->activity) {
         $request->session()->flash('flash_message', 'This event has no activity data.');
         return Redirect::back();
     }
     $amount = $request->input('amount');
     if ($amount < 1) {
         $request->session()->flash('flash_message', 'The amount of helpers should be positive.');
         return Redirect::back();
     }
     $committee = Committee::findOrFail($request->input('committee'));
     $help = HelpingCommittee::create(['activity_id' => $event->activity->id, 'committee_id' => $committee->id, 'amount' => $amount]);
     foreach ($committee->users as $user) {
         $name = $user->name;
         $email = $user->email;
         $helptitle = $help->activity->event->title;
         Mail::queue('emails.committeehelpneeded', ['user' => $user, 'help' => $help], function ($m) use($name, $email, $helptitle) {
             $m->replyTo('board@proto.utwente.nl', 'S.A. Proto');
             $m->to($email, $name);
             $m->subject('The activity ' . $helptitle . ' needs your help.');
         });
     }
     $request->session()->flash('flash_message', 'Added ' . $committee->name . ' as helping committee.');
     return Redirect::back();
 }
开发者ID:saproto,项目名称:saproto,代码行数:27,代码来源:ActivityController.php

示例10: writeBlog

 public function writeBlog(Request $request)
 {
     date_default_timezone_set('Asia/Shanghai');
     $title = $request->input('title', '');
     $label = $request->input('type', '');
     $content = $request->input('content', '');
     $pretitle = $request->input('pretitle', '');
     $privacy = $request->input('privacy');
     if ($content != '' && $title != '') {
         if ($pretitle != '') {
             $essay_id = DB::select('select id from essay where title = ?', [$pretitle]);
             DB::delete('delete from essay where title = ?', [$pretitle]);
             DB::delete('delete from label where essay_id = ?', [$essay_id[0]->id]);
         }
         DB::table('essay')->insert(['title' => $title, 'author' => 'sunji', 'date' => date('Y-m-d H:m:s'), 'content' => EndaEditor::MarkDecode($content), 'previledge' => $privacy]);
         $essay_id = DB::select('select id from essay where title = ?', [$title]);
         if ($label != "") {
             $retArr = explode(',', $label);
             foreach ($retArr as $a) {
                 if ($a == '') {
                     continue;
                 }
                 DB::table('label')->insert(['label' => $a, 'essay_id' => $essay_id[0]->id]);
             }
         }
     } else {
         echo "NULL CONTENT";
     }
     return redirect('/blog/newlist');
 }
开发者ID:greatji,项目名称:personalWebsite,代码行数:30,代码来源:Controller.php

示例11: nuevo

 public function nuevo(Request $request)
 {
     //recibir los datos del request
     //instanciar una nueva persona
     //guardar en la base
     $apellido = $request->input("apellido");
     $nombre = $request->input("nombre");
     $documento = $request->input("documento");
     /*$sexo      = $request ->input("sexo");
       $nacionalidad      = $request ->input("nacionalidad");
       $archivosExt      = $request ->input("archivos_externos");
       $fechaExp      = $request ->input("fecha_expedicion");
       $fechaVenc      = $request ->input("fecha_vencimiento");
       $domicilio      = $request ->input("domicilio");
       $ciudad      = $request ->input("ciudad");
       $departamento      = $request ->input("departamento");
       $provincia      = $request ->input("provincia");
       $fechaNac      = $request ->input("fecha_nacimiento");
       $ugarNac      = $request ->input("lugar_nacimiento");*/
     $reglas = ['apellido' => 'required|min:3|max:50', 'nombre' => 'required|min:3|max:50', 'documento' => 'required|min:8|max:99999999'];
     //validamos...
     $this->validate($request, $reglas);
     $clientes = new Cliente();
     $clientes->apellido = $apellido;
     $clientes->nombre = $nombre;
     $clientes->documento = $documento;
     $clientes->save();
     return redirect('clientes');
 }
开发者ID:NewCharmeleon,项目名称:Museo_Salesiano.Alpha,代码行数:29,代码来源:ClienteController.php

示例12: postIndex

 /**
  * Responds to requests to POST /users
  */
 public function postIndex(Request $request)
 {
     // create Faker instance
     $faker = Faker\Factory::create();
     // Get user options
     $phone = $request->input('phone');
     // Should a phone number be displayed
     $address = $request->input('address');
     // Should a full or partial address be displayed
     // Generate required information
     $userName = $faker->name();
     $userCity = $faker->city();
     $userState = $faker->stateAbbr();
     // Check for and generate optional information, else set deselected variables to null
     if ($address == 1) {
         $userStreet = $faker->streetAddress();
         $userZip = $faker->postcode();
     } else {
         $userStreet = null;
         $userZip = null;
     }
     if ($phone == 1) {
         $userPhone = $faker->phoneNumber();
     } else {
         $userPhone = null;
     }
     // Send user information to View
     return view('users.index')->with('userName', $userName)->with('userStreet', $userStreet)->with('userCity', $userCity)->with('userState', $userState)->with('userZip', $userZip)->with('userPhone', $userPhone);
 }
开发者ID:andrewkramer,项目名称:p3,代码行数:32,代码来源:UsersController.php

示例13: save

 public function save(Request $request, $id)
 {
     $status = new Status();
     $status->problem_id = $id;
     $status->user_id = '0';
     $status->time = '0';
     $status->memory = '0';
     $leng = $request->input('leng');
     $status->language = $leng;
     //$status->source_code=
     $status->save();
     $status = Status::orderby('solution_id', 'desc')->first();
     $compile = new Compileinfo();
     $compile->solution_id = $status->solution_id;
     $compile->save();
     $code = new Source_code();
     $code->solution_id = $status->solution_id;
     $code->source = $request->input('editor');
     $code->save();
     $code = Source_code::orderby('sourcecode_id', 'desc')->first();
     $run = new Run();
     $run->solution_id = $status->solution_id;
     $run->problem_id = $id;
     $run->language = $leng;
     $run->sourcecode_id = $code->sourcecode_id;
     $run->save();
     return redirect('status/status');
 }
开发者ID:patitoteam,项目名称:PatitoOnlineJudge,代码行数:28,代码来源:SubmitController.php

示例14: post

 public function post($id, Request $request)
 {
     $idEvaluation = Evaluation::join('type_evaluations', 'type_evaluations.id', '=', 'evaluations.type_evaluation_id')->where('evaluations.id', $id)->first();
     $criteres = CritereTypeEvaluation::join('criteres', 'criteres.id', '=', 'critere_type_evaluation.critere_id')->where('type_evaluation_id', $idEvaluation->type_evaluation_id)->get();
     //$enseignant = EnseignantEvaluationRole::where('enseignant_id', )
     //                                        ->where('evaluation_id', $id)
     //                                        ->first();
     $total = 0;
     foreach ($criteres as $key => $critere) {
         //enseignant_id dans le foreach à rajouter
         CritereEnseignantEvaluation::insert([['noteCritere' => $request->input('critere' . $critere->critere_id), 'critere_id' => $critere->critere_id, 'enseignant_id' => 4, 'evaluation_id' => $id]]);
         $total = $total + $request->input('critere' . $critere->critere_id);
     }
     //if ($enseigant->role_id==1) {
     //    $total=($total+$idEvaluation->noteGroupe)/2;
     //}
     Evaluation::where('evaluations.id', $id)->update(['noteGroupe' => $total]);
     //mettre le jury en à voté
     EnseignantEvaluationRole::where('enseignant_id', 4)->where('evaluation_id', $id)->update(['vote' => 1]);
     //retour selon maitre ou esclave
     //if ($enseigant->role_id==1) {
     //    return redirect()->action('RecapitulationController@show',$id);
     //}else{
     //    return redirect()->action('GroupeProjetController@index');
     //}
     return redirect()->action('RecapitulationController@show', $id);
 }
开发者ID:ThibaudPerrin,项目名称:appliSoutenance,代码行数:27,代码来源:GroupeProjetController.php

示例15: sectionTitle

 public function sectionTitle(Request $request)
 {
     $input = $request->input();
     $template = view()->file(app_path('Http/Templates/section-title.blade.php'), $request->input());
     Session::flash('data', $input);
     return view('items.show')->with(['template' => $template]);
 }
开发者ID:pjsinco,项目名称:roundupper.10rempatrick.com,代码行数:7,代码来源:ItemsController.php


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