本文整理汇总了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;
}
示例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);
}
示例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());
}
示例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'));
}
}
示例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'));
}
}
示例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 :)');
}
}
示例7: dumpster
/**
* Display a listing of the trashed resources.
*
* @return Illuminate\View\View
*/
public function dumpster()
{
Input::merge(['trashed' => 'only']);
return $this->index();
}
示例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]);
}
示例9: globalXssClean
public static function globalXssClean()
{
// Recursive cleaning for array [] inputs, not just strings.
$sanitized = static::arrayStripTags(Input::get());
Input::merge($sanitized);
}
示例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);
}