當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Input::merge方法代碼示例

本文整理匯總了PHP中Illuminate\Support\Facades\Input::merge方法的典型用法代碼示例。如果您正苦於以下問題:PHP Input::merge方法的具體用法?PHP Input::merge怎麽用?PHP Input::merge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Support\Facades\Input的用法示例。


在下文中一共展示了Input::merge方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handle

 /**
  * handle the command
  *
  * @param $command
  * @return mixed
  */
 public function handle($command)
 {
     Input::merge(['roleIds' => []]);
     $this->execute(UpdateUserRolesCommand::class);
     $user = User::deleteUser($command->userId);
     $this->dispatchEventsFor($user);
     return $user;
 }
開發者ID:arminsam,項目名稱:SimpleUserManagement,代碼行數:14,代碼來源:DeleteUserCommandHandler.php

示例2: removeHtmlExclude

 /**
  * 
  * @param type $arr : all fields to handle origin data
  */
 public static function removeHtmlExclude($arr_exclude = array())
 {
     $data_new = array();
     $data = Input::all();
     foreach ($data as $key => $item) {
         if (!in_array($key, $arr_exclude)) {
             if (!is_array($item)) {
                 $data_new[$key] = htmlspecialchars($item);
             } else {
             }
         }
     }
     Input::merge($data_new);
 }
開發者ID:leehanse,項目名稱:smartadmin,代碼行數:18,代碼來源:FilterData.php

示例3: testOrder

 public function testOrder()
 {
     $should = array(array('id' => 'eoo'), array('id' => 'foo'));
     Input::replace(array('iSortCol_0' => 0, 'sSortDir_0' => 'asc'));
     $engine = new CollectionEngine(new Collection($this->getTestArray()));
     $engine->addColumn(new FunctionColumn('id', function ($model) {
         return $model['id'];
     }));
     $engine->setAliasMapping();
     $this->assertEquals($should, $engine->getArray());
     Input::merge(array('iSortCol_0' => 0, 'sSortDir_0' => 'desc'));
     $should2 = array(array('id' => 'foo'), array('id' => 'eoo'));
     $this->assertEquals($should2, $engine->getArray());
 }
開發者ID:Cyber-Duck,項目名稱:Datatable,代碼行數:14,代碼來源:CollectionEngineTest.php

示例4: login

 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Laravel\Lumen\Http\Redirector
  */
 public function login(Request $request)
 {
     // set default web oauth client
     Input::merge(['client_id' => Config::get('oauth2.web_client.client_id')]);
     Input::merge(['client_secret' => Config::get('oauth2.web_client.client_secret')]);
     Input::merge(['grant_type' => 'password']);
     try {
         \Authorizer::issueAccessToken();
         return redirect('/');
     } catch (\Exception $e) {
         $request->session()->flash('error', 'auth.login_error');
         return redirect(route('auth.loginForm'));
     }
 }
開發者ID:ndrx-io,項目名稱:elude,代碼行數:18,代碼來源:Auth.php

示例5: callback

 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse|\Laravel\Lumen\Http\Redirector
  */
 public function callback(Request $request)
 {
     $state = $request->get('state');
     $sessionState = Session::get('google.oauth2state');
     $code = $request->get('code');
     if ($request->get('error')) {
         $request->session()->flash('error', 'auth.error');
         return redirect(route('auth.loginForm'));
     }
     if (empty($state) || $state !== $sessionState) {
         Session::forget('google.oauth2state');
         $request->session()->flash('error', 'auth.error');
         return redirect(route('auth.loginForm'));
     }
     $token = $this->provider->getAccessToken('authorization_code', ['code' => $code]);
     try {
         /** @var GoogleUser $ownerDetails */
         $ownerDetails = $this->provider->getResourceOwner($token);
         $email = $ownerDetails->getEmail();
         // if we already have the email in DB we log the user
         if (!$this->repository->exists(['email' => $email])) {
             $lastName = $ownerDetails->getLastName();
             $firstName = $ownerDetails->getFirstName();
             $this->createUser($firstName, $lastName, $email);
         }
         // we try to logged in the user with the email and the google oauth access token
         Input::merge(['client_id' => Config::get('oauth2.web_client.client_id')]);
         Input::merge(['client_secret' => Config::get('oauth2.web_client.client_secret')]);
         Input::merge(['grant_type' => 'google']);
         Input::merge(['username' => $email]);
         Input::merge(['password' => $token->getToken()]);
         try {
             Authorizer::issueAccessToken();
             return redirect('/');
         } catch (\Exception $e) {
             $request->session()->flash('error', 'auth.login_error');
             return redirect(route('auth.loginForm'));
         }
     } catch (ModelNotValid $e) {
         $request->session()->flash('error', 'auth.error');
         Log::warn($e->getMessage());
         return redirect(route('auth.loginForm'));
     } catch (\Exception $e) {
         $request->session()->flash('error', 'auth.error');
         Log::warn($e->getMessage());
         return redirect(route('auth.loginForm'));
     }
 }
開發者ID:ndrx-io,項目名稱:elude,代碼行數:52,代碼來源:Google.php

示例6: sendMail

 public function sendMail(Request $request)
 {
     $rules = array('name' => 'required|max:50', 'email' => 'required|email|max:100', 'phone' => 'numeric|digits_between:9,15', 'subject' => 'required|max:100', 'content' => 'required|min:10');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         $messages = $validator->messages()->toArray();
         foreach ($messages as $field => $message) {
             Input::merge(array($field => ''));
         }
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         $data = ['email' => 'info@pixsens.co.uk', 'name' => 'Pixsens Team'];
         Mail::send('emails.contact', ['content' => Input::get('content'), 'phone' => Input::get('phone'), 'name' => Input::get('name')], function ($m) use($data) {
             $m->from(Input::get('email'), Input::get('name'));
             $m->to($data['email'], $data['name'])->subject(Input::get('subject'));
         });
         return Redirect::back()->with('success', 'Thank you for your message :)');
     }
 }
開發者ID:spwin,項目名稱:pixlondon,代碼行數:19,代碼來源:PagesController.php

示例7: dumpster

 /**
  * Display a listing of the trashed resources.
  *
  * @return Illuminate\View\View
  */
 public function dumpster()
 {
     Input::merge(['trashed' => 'only']);
     return $this->index();
 }
開發者ID:esensi,項目名稱:core,代碼行數:10,代碼來源:DumpsterControllerTrait.php

示例8: update_aircraft

 public function update_aircraft(Request $request)
 {
     $id = Input::get('projectaircraft_id');
     $craft_type_id = Aircraft::where('model', $request->input('type_id'))->pluck('id');
     Input::merge(['type_id' => $craft_type_id]);
     $ace = ProjectEngine::where('project_id', $id)->count();
     if ((int) $ace == 0) {
         $cntEngines = Aircraft::where('id', $craft_type_id)->pluck('engine_count');
         for ($e = 1; $e <= $cntEngines; $e++) {
             ProjectEngine::create(['project_id' => $id, 'position' => 'P' . $e]);
         }
         // end for
     }
     $record = ProjectAircraft::updateOrCreate(['project_id' => $id], Input::all());
     return redirect()->action('ProjectsController@engines', ['project' => $id]);
 }
開發者ID:wyrover,項目名稱:aeroeco,代碼行數:16,代碼來源:ProjectsController.php

示例9: globalXssClean

 public static function globalXssClean()
 {
     // Recursive cleaning for array [] inputs, not just strings.
     $sanitized = static::arrayStripTags(Input::get());
     Input::merge($sanitized);
 }
開發者ID:cednet,項目名稱:laravel-cms-addon,代碼行數:6,代碼來源:Helper.php

示例10: index


//.........這裏部分代碼省略.........
        "to": 2,
        "data": [
          {
            "id_position": 2,
            "id_user": 1,
            "latitude": "4.712",
            "longitude": "-74.454",
            "updatetime": "2015-07-07 16:35:00"
          },
          {
            "id_position": 1,
            "id_user": 1,
            "latitude": "4.712",
            "longitude": "-74.454",
            "updatetime": "2015-07-07 16:35:00"
          }
        ]
      }
    }
 * <p>
 * </p>
 *
 * @param Request $request
 *
 * @return Json
 */
 public function index(Request $request)
 {
     $resp = array();
     $status = 200;
     $resp['error'] = true;
     $resp['msg'] = 'Ocurrió un error';
     $resp['data'] = null;
     $access_token = $request->header('X-Session-Token');
     $imei = $request->header('X-imei');
     $os = $request->header('X-OS');
     $resp['msg'] = 'Faltan campos que son obligatorios';
     if (!is_null($imei) && !is_null($os) && !is_null($access_token)) {
         $resp['msg'] = 'Acess token inválido';
         $status = 401;
         $user = UserToken::where('access_token', '=', $access_token)->where('is_valid', '=', true)->where('ts_valid_until', '>=', 'NOW()')->first();
         if ($user) {
             $posiciones = new Position();
             $posiciones = $posiciones->where('id_user', '=', $user->id_user);
             if ($request->has('filters')) {
                 $filtros = json_decode($request->input('filters'), false);
                 foreach ($filtros as $filtro) {
                     $campo = $filtro->field;
                     $operador = $filtro->comparison;
                     switch ($operador) {
                         case 'eq':
                             $operador = '=';
                             break;
                         case 'lt':
                             $operador = '<';
                             break;
                         case 'gt':
                             $operador = '>';
                             break;
                         case 'lte':
                             $operador = '<=';
                             break;
                         case 'gte':
                             $operador = '>=';
                             break;
                         default:
                             $operador = '=';
                             break;
                     }
                     $valor = $filtro->value;
                     $posiciones = $posiciones->where($campo, $operador, $valor);
                 }
             }
             if ($request->has('sort')) {
                 $sorts = json_decode($request->input('sort'), false);
                 foreach ($sorts as $sort) {
                     $campo = $sort->field;
                     $direccion = $sort->direction;
                     $posiciones = $posiciones->orderBy($campo, $direccion);
                 }
             }
             $page = 1;
             if ($request->has('page')) {
                 $page = json_decode($request->input('page'), false);
             }
             Input::merge(array('page' => $page));
             $limit = 2;
             if ($request->has('limit')) {
                 $limit = json_decode($request->input('limit'), false);
             }
             $coleccion = $posiciones->paginate($limit);
             $status = 200;
             $resp['error'] = false;
             $resp['msg'] = 'OK';
             $resp['data'] = array();
             $resp['data'] = $coleccion->toArray();
         }
     }
     return new Response($resp, $status);
 }
開發者ID:ssinucodt,項目名稱:apitest,代碼行數:101,代碼來源:PositionController.php


注:本文中的Illuminate\Support\Facades\Input::merge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。