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


PHP Request::input方法代码示例

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


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

示例1: saveData

 /**
  * Save data.
  *
  * @param Request $request Request
  * @param Int     $user_id User id
  *
  * @return int
  */
 public function saveData($request, $user_id = '')
 {
     $password = '';
     $role_id = $request->input('role_id');
     if ($user_id) {
         $user = self::find($user_id);
         //Dectach
         $user->roles()->detach();
         $password = $user->password;
     } else {
         // Check duplicate
         $email = $request->input('email');
         $check_user = self::where('email', '=', $email)->first();
         if ($check_user) {
             return false;
         } else {
             $user = new self();
         }
     }
     $new_password = bcrypt($request->input('password'));
     if (!$new_password) {
         $new_password = $password;
     }
     $user->name = $request->input('name');
     $user->email = $request->input('email');
     $user->password = $new_password;
     $results = $user->save();
     if ($results) {
         $user->roles()->attach($role_id);
         return $user->id;
     } else {
         return $results;
     }
 }
开发者ID:dungnh,项目名称:survey_online,代码行数:42,代码来源:User.php

示例2: postBatch

 public function postBatch($act = 'update')
 {
     $result = false;
     switch ($act) {
         case 'delete':
             $ids = \Request::input('ids');
             $idsArr = explode(',', $ids);
             $result = FeedBack::whereIn('id', $idsArr)->delete();
             break;
         case 'update':
             $key = \Request::input('key');
             $val = \Request::input('value');
             $key = $key == '_status' ? 'status' : '';
             if (!empty($key)) {
                 $ids = \Request::input('ids');
                 $idsArr = explode(',', $ids);
                 $result = FeedBack::whereIn('id', $idsArr)->update([$key => $val]);
             }
             break;
     }
     $msg = [];
     if ($result) {
         $msg['status'] = 'success';
     } else {
         $msg['status'] = 'failed';
     }
     return response(json_encode($msg))->header('Content-Type', 'application/json');
 }
开发者ID:jay4497,项目名称:j4cms,代码行数:28,代码来源:FeedBackController.php

示例3: registerRoutes

 public static function registerRoutes()
 {
     Route::post('upload/' . static::$route, ['as' => 'admin.upload.' . static::$route, function () {
         $validator = Validator::make(\Request::all(), static::uploadValidationRules());
         if ($validator->fails()) {
             return Response::make($validator->errors()->get('file'), 400);
         }
         $file = \Request::file('file');
         $upload_path = config('admin.filemanagerDirectory') . \Request::input('path');
         $orginalFilename = str_slug(pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME));
         $filename = $orginalFilename . '.' . $file->getClientOriginalExtension();
         $fullpath = public_path($upload_path);
         if (!\File::isDirectory($fullpath)) {
             \File::makeDirectory($fullpath, 0755, true);
         }
         if ($oldFilename = \Request::input('filename')) {
             \File::delete($oldFilename);
         }
         if (\File::exists($fullpath . '/' . $filename)) {
             $filename = str_slug($orginalFilename . '-' . time()) . '.' . $file->getClientOriginalExtension();
         }
         $filepath = $upload_path . '/' . $filename;
         $file->move($fullpath, $filename);
         return ['url' => asset($filepath), 'value' => $filepath];
     }]);
     Route::post('upload/delete/' . static::$route, ['as' => 'admin.upload.delete.' . static::$route, function () {
         if ($filename = \Request::input('filename')) {
             \File::delete($filename);
             return "Success";
         }
         return null;
     }]);
 }
开发者ID:pseudoagentur,项目名称:soa-sentinel,代码行数:33,代码来源:Image.php

示例4: getGet

 /**
  * Funcao usada pelo ajax para buscar o relatorio informando o nome da action
  * 
  * @return json Relatorio formatado para o Google Charts
  */
 public function getGet(ReportLogic $r)
 {
     // Busca o nome do relatorio
     // $report_namespace = $this;
     $report_request = \Request::input('report');
     // Atribui um rows vazio
     $rows = array();
     // Verifica se é mesmo um report request!
     if (substr($report_request, 0, 6) === 'report' && method_exists($this, $report_request)) {
         $rows = $this->{$report_request}();
     } else {
         // Joga uma exception caso nao exista!
         abort(405, 'Inexistente!');
     }
     // Comeca o tratamento do array de configuracoes do Google Charts
     $arrConfig = [];
     // Adiciona as linhas no Logic
     $r->setBody($rows);
     // Montador de colunas
     $arrConfig['cols'] = $r->getHeadersFormat('js');
     // Montador de linhas
     $arrConfig['rows'] = $r->getBodyFormat('js');
     // Retorna o array para o laravel, que ira retornar o json
     return $arrConfig;
 }
开发者ID:mkny,项目名称:cinimod,代码行数:30,代码来源:ReportController.php

示例5: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $unit
  * @return Response
  */
 public function update(Printer $printer)
 {
     $printer->fill(\Request::input())->save();
     //        $printer->authors()->detach();
     //        $printer->authors()->attach( $request->input('authors_id') );
     return redirect('printers');
 }
开发者ID:stobys,项目名称:laravel5-work,代码行数:13,代码来源:PrintersController.php

示例6: relation

 /**
  * 设置工作流步骤的关联人员
  * 
  * @return string
  */
 public function relation($data)
 {
     $this->setCurrentAction('step', 'relation', 'workflow')->checkPermission();
     $url = R('common', $this->module . '.' . $this->class . '.' . $this->function, ['stepid' => $data['id'], 'workflow_id' => \Request::input('id')]);
     $html = $this->hasPermission ? '<a class="step-relation" target="_blank" href="' . $url . '"><i class="fa fa-user"></i></a>' : '<i class="fa fa-user" style="color:#ccc"></i>';
     return $html;
 }
开发者ID:mikegit2014,项目名称:laravelback,代码行数:12,代码来源:WorkflowStep.php

示例7: index

 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     if ($body = \Request::input('body')) {
         $translation = Translation::where('body', $body)->first();
         if ($translation) {
             $response = response()->json([['id' => $translation->getId(), 'body' => $translation->body]]);
         } else {
             $response = response()->json(['errors' => ['The translation hasn\'t found.']], 404);
         }
     } else {
         if ($autocomplete = \Request::input('autocomplete')) {
             $translations = Translation::select('body')->where('body', 'LIKE', "{$autocomplete}%")->take(\Request::header('Limit') ?: 5)->get();
             if (count($translations) > 0) {
                 $response = response()->json($translations);
             } else {
                 $response = response()->json(['errors' => ['The matched translations haven\'t found.']], 404);
             }
         } else {
             $result = Translation::paginate(\Request::header('Limit') ?: 10);
             $headers['Current-Page'] = $result->currentPage();
             $headers['Last-Page'] = $result->lastPage();
             $translations = [];
             foreach ($result as $key => $item) {
                 $translations[$key]['id'] = $item->getId();
                 $translations[$key]['body'] = $item->body;
             }
             if (count($translations) > 0) {
                 $response = response()->json($translations, 200, $headers);
             } else {
                 $response = response()->json(['errors' => ['there aren\'t any translations.']], 404);
             }
         }
     }
     return $response;
 }
开发者ID:disik69,项目名称:backend.english-roulette-v0.3,代码行数:40,代码来源:TranslationController.php

示例8: update

 public function update($id)
 {
     $user_id = \Request::input('user_id');
     $checkBorrowCount = BookUser::whereUser_idAndStatus($user_id, 'pinjam')->count();
     $checkOrderCount = BookUser::whereUser_idAndStatus($user_id, 'pesan')->count();
     $checkCount = $checkBorrowCount + $checkOrderCount;
     if ($checkCount < 5) {
         $check = BookUser::whereUser_idAndBook_idAndStatus($user_id, $id, 'pinjam')->count();
         if ($check < 1) {
             $book = Book::find($id);
             $book->stock -= 1;
             $book->save();
             $data = new BookUser();
             $data->user_id = $user_id;
             $data->book_id = $id;
             $data->status = 'pinjam';
             $data->save();
             return redirect('operator/transactions')->with('successMessage', 'Berhasil meminjam buku.');
         } else {
             return redirect('operator/borrow')->with('errorMessage', 'User hanya bisa meminjam 1 buku dengan judul yang sama.');
         }
     } else {
         return redirect('operator/borrow')->with('errorMessage', 'User Hanya bisa memesan/meminjam 5 buku');
     }
 }
开发者ID:satriowisnugroho,项目名称:LIST,代码行数:25,代码来源:BorrowController.php

示例9: process

 public function process(Request $request)
 {
     // Ajax-validation is only possible, if the _formID was submitted (automatically done by the FormBuilder).
     if (\Request::has('_formID')) {
         // The FormBuilder should have saved the requestObject this form uses inside the session.
         // We check, if it is there, and can continue only, if it is.
         $sessionKeyForRequestObject = 'htmlBuilder.formBuilder.requestObjects.' . \Request::input('_formID');
         if (Session::has($sessionKeyForRequestObject)) {
             // Normally we assume a successful submission and return just an empty JSON-array.
             $returnCode = 200;
             $return = [];
             // We instantiate the requestObject.
             $formRequest = FormBuilderTools::getRequestObject(Session::get($sessionKeyForRequestObject));
             // We instantiate a controller with the submitted request-data
             // and the rules and messages from the requestObject.
             $validator = Validator::make(\Request::all(), $formRequest->rules(), $formRequest->messages());
             // Perform validation, extract error-messages for all fields on failure, put them inside a $return['errors']-array, and return status code 422.
             if ($validator->fails()) {
                 $errors = [];
                 foreach (array_dot(\Request::all()) as $fieldName => $fieldValue) {
                     $fieldErrors = FormBuilderTools::extractErrorsForField($fieldName, $validator->errors()->getMessages(), \Request::all());
                     if (count($fieldErrors) > 0) {
                         $errors[FormBuilderTools::convertArrayFieldDotNotation2HtmlName($fieldName)] = $fieldErrors;
                     }
                 }
                 $return['errors'] = $errors;
                 $returnCode = 422;
             }
             return new JsonResponse($return, $returnCode);
         }
     }
 }
开发者ID:nic-at,项目名称:htmlbuilder,代码行数:32,代码来源:AjaxValidationController.php

示例10: KisiSil

 function KisiSil()
 {
     \Auth::logout();
     \Session::flush();
     \DB::delete('delete from users WHERE name = ?', [\Request::input('isim')]);
     return \Redirect::to('auth/register');
 }
开发者ID:hramose,项目名称:Laravel5-Admin-3,代码行数:7,代码来源:TekinController.php

示例11: postFinishedtask

 public function postFinishedtask()
 {
     $reservedhour = \App\ReservedHours::find(\Request::input('hour_id'));
     \App\FinishedHour::create(array('user_id' => $reservedhour->user_id, 'service_id' => $reservedhour->service_id, 'client' => $reservedhour->client, 'price' => $reservedhour->service->price, 'created_at' => date('Y-m-d')));
     \DB::table('reservedhours')->where('id', '=', $reservedhour->id)->delete();
     return 'true';
 }
开发者ID:DiCore,项目名称:hours,代码行数:7,代码来源:TaskController.php

示例12: showResetForm

 /**
  * Display the password reset view for the given token.
  *
  * If no token is present, display the link request form.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  string|null  $token
  * @return \Illuminate\Http\Response
  */
 public function showResetForm(Request $request, $token = null)
 {
     $email = $request->input('email');
     if (view()->exists('auth.passwords.reset')) {
         return view('auth.passwords.reset')->with(compact('token', 'email'));
     }
     return view('auth.reset')->with('token', $token);
 }
开发者ID:CupOfTea696,项目名称:CardsAgainstTea,代码行数:17,代码来源:PasswordController.php

示例13: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $permisos = \App\Permisos::find($id);
     $permisos->id_opcion = \Request::input('opcion');
     $permisos->UserLevelID = \Request::input('nivel_usuario');
     $permisos->save();
     return redirect('permisos');
 }
开发者ID:hramose,项目名称:Sistema-Control-de-Almacen,代码行数:14,代码来源:PermisosController.php

示例14: update

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $nivel = \App\UserLevel::find($id);
     $nivel->UserLevelID = \Request::input('nivel_usuario');
     $nivel->UserLevelName = \Request::input('nombre_nivel');
     $nivel->save();
     return redirect('niveles')->with('message', 'Se ha actualizado el registro');
 }
开发者ID:hramose,项目名称:Sistema-Control-de-Almacen,代码行数:14,代码来源:NivelesController.php

示例15: getIndex

 /**
  * Funcao para edicao da traducao do [Modulo]
  * @param string $controller Nome do controlador
  * @return void
  */
 public function getIndex($controller = false)
 {
     $lang = \Request::input('lang');
     if (!$lang) {
         $lang = \App::getLocale();
     }
     return view('cinimod::admin.generator.trans')->with(['langlist' => $this->_getLangPacks(), 'langlist_sel' => $lang, 'langfiles' => $this->_getTransFiles($lang)]);
 }
开发者ID:mkny,项目名称:cinimod,代码行数:13,代码来源:TranslateController.php


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