本文整理汇总了PHP中Illuminate\Http\Request::Input方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::Input方法的具体用法?PHP Request::Input怎么用?PHP Request::Input使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Http\Request
的用法示例。
在下文中一共展示了Request::Input方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* modifica un usuario y/o persona en la base de datos
*
* @param parametros enviados del formulario en $request
* @return vista perfil
*/
public function store(Request $request)
{
$usuario = DB::table('usuario')->where('id', $_COOKIE['id'])->first();
$persona = DB::table('persona')->where('id', $usuario->personaid)->first();
$usuarioActualizado = Usuario::find($usuario->id);
$personaActualizada = Persona::find($persona->id);
if ($request->input('nombre') != '') {
$personaActualizada->nombres = $request->input('nombre');
}
if ($request->input('apellido') != '') {
$personaActualizada->apellidos = $request->input('apellido');
}
if ($request->input('usuario') != '') {
$validator = Validator::make($request->all(), ['usuario' => 'unique:usuario'], ['unique' => 'ya existe el :attribute.']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator->errors())->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
}
$usuarioActualizado->usuario = $request->input('usuario');
}
if ($request->input('contrasenia') != '') {
$con1 = $request->Input('contrasenia');
$con2 = $request->Input('conContrasenia');
$validator = Validator::make($request->all(), ['contrasenia' => 'max:16|min:8'], ['min' => 'La contraseña debe tener como minimo 8 caracteres.', 'max' => 'La contraseña debe tener como maximo 16 caracteres.']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator->errors())->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
}
if ($con1 != $con2) {
return redirect()->back()->withErrors('las contraseñas son diferentes')->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
}
$usuarioActualizado->contrasenya = bcrypt($request->input('contrasenia'));
}
if ($request->input('correo') != '') {
$validator = Validator::make($request->all(), ['correo' => 'unique:usuario'], ['unique' => 'ya existe el :attribute.']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator->errors())->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
}
$usuarioActualizado->correo = $request->input('correo');
}
if ($request->input('sexo') != '') {
$personaActualizada->sexo = $request->input('sexo');
}
if ($request->input('fechaNacimiento') != '') {
$personaActualizada->fechaNacimiento = $request->input('fechaNacimiento');
}
if ($request->input('palomita') == true) {
//Storage::delete('/public/imagenpersona/'.$persona->ubicacionavatar);
$imageName = str_replace(" ", "-", $usuario->usuario) . "_" . rand(11111, 99999) . '.' . $request->file('avatar')->getClientOriginalExtension();
$request->file('avatar')->move(base_path() . '/public/imagenpersona/', $imageName);
$personaActualizada->ubicacionavatar = $imageName;
}
$personaActualizada->save();
$usuarioActualizado->save();
setcookie("id", $usuario->id);
setcookie("usuario", $usuario->usuario);
return redirect('/perfil');
}
示例2: guardar_baners
public function guardar_baners(Request $request)
{
// dd($request->all());
// dd($request->hasFile('baner1'));
$ruta = base_path();
$ruta = $ruta . '/../www/img/';
//dd($ruta);
if (Input::hasFile('baner1')) {
Input::file('baner1')->move($ruta, 'baner1.jpg');
$guardar = baner::find(1);
//dd($guardar->link);
$guardar->link = $request->Input('link1');
$guardar->save();
# code...
}
if (Input::hasFile('baner2')) {
Input::file('baner2')->move($ruta, 'baner2.jpg');
$guardar = baner::findOrFail(2);
//dd($guardar);
$guardar->link = $request->input('link2');
$guardar->save();
# code...
}
if (Input::hasFile('baner3')) {
Input::file('baner3')->move($ruta, 'baner3.jpg');
$guardar = baner::findOrFail(3);
//dd($guardar);
$guardar->link = $request->input('link3');
$guardar->save();
# code...
}
if (Input::hasFile('baner4')) {
Input::file('baner4')->move($ruta, 'baner4.jpg');
$guardar = baner::findOrFail(4);
//dd($guardar);
$guardar->link = $request->input('link4');
$guardar->save();
# code...
}
return redirect()->route('backend.dashboard')->withFlashSuccess("Baners actualizados.");
}
示例3: apiRegister
public function apiRegister(Request $request)
{
$model = $request->Input('model');
$manufacturer = $request->Input('manufacturer');
$product = $request->Input('product');
$sdk_version = $request->Input('sdk_version');
$serial_number = $request->Input('serial_number');
$latitude = $request->Input('latitude');
$longitude = $request->input('longitude');
// Check if serial number exists in database
$newDevice = Device::where('serial_number', '=', $serial_number)->first();
if (null == $newDevice) {
$newDevice = new Device();
$newDevice->model = $model;
$newDevice->manufacturer = $manufacturer;
$newDevice->product = $product;
$newDevice->sdk_version = $sdk_version;
$newDevice->serial_number = $serial_number;
$newDevice->latitude = $latitude;
$newDevice->longitude = $longitude;
$newDevice->save();
}
return $newDevice->jsonSerializable();
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
$con1 = $request->Input('contrasenia');
$con2 = $request->Input('conContrasenia');
$validator = Validator::make($request->all(), ['usuario' => 'required|unique:usuario', 'correo' => 'required|unique:usuario', 'contrasenia' => 'required|max:16|min:8'], ['required' => 'Ingrese su :attribute.', 'unique' => 'ya existe el :attribute.', 'min' => 'La contraseña debe tener como minimo 8 caracteres.', 'max' => 'La contraseña debe tener como maximo 16 caracteres.']);
if ($validator->fails()) {
return redirect()->back()->withErrors($validator->errors())->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
} else {
if ($con1 != $con2) {
return redirect()->back()->withErrors('las contraseñas son diferentes')->withInput($request->except('contrasenia'))->withInput($request->except('conContrasenia'));
}
}
$nuevaPersona = new Persona();
$nuevaPersona->nombres = "";
$nuevaPersona->apellidos = "";
$nuevaPersona->fechanacimiento = "";
$nuevaPersona->ubicacionavatar = "";
$nuevaPersona->sexo = "";
$nuevaPersona->save();
$usuario = new Usuario();
$usuario->usuario = $request->input('usuario');
$usuario->correo = $request->input('correo');
$usuario->contrasenya = bcrypt($request->input('contrasenia'));
$usuario->personaid = $nuevaPersona->id;
$usuario->tipousuarioid = 3;
$usuario->save();
setcookie("id", $usuario->id);
setcookie("usuario", $usuario->usuario);
return redirect('/completarinformacion');
}
示例5: updateAnswer
/**
* save answer of admin to questions
* @param Request $request
* @return \Illuminate\Http\RedirectResponse
*/
public function updateAnswer(Request $request)
{
$id = $request->Input('id');
$answer = $request->Input('answer');
DB::table('contacts')->where('id', $id)->update(['answer' => $answer]);
$answerSuccess = true;
return redirect()->back()->with('answerSuccess', $answerSuccess);
}
示例6: postCreate
/**
* Responds to requests to POST create
*/
public function postCreate(Request $request)
{
$howMany = $request->Input('howMany');
$generate = $request->Input('generate');
$ckArticle = $request->Input('ckArticle');
$ckItalic = $request->Input('ckItalic');
$ckBold = $request->Input('ckBold');
$result = helper::generatelorim($howMany, $generate, $ckArticle, $ckItalic, $ckBold);
return view('pages.loremipsum')->with('result', $result);
}
示例7: postCreate
/**
* Responds to requests to POST create
*/
public function postCreate(Request $request)
{
$howMany = $request->Input('howMany');
$user = helper::generateuser($howMany);
//dd($user);
return view('pages.randomuser')->with('user', $user);
}
示例8: refreshNotifications
/**
* regresh notification panel and icon
* @param Request $request
* @return $this
*/
public function refreshNotifications(Request $request)
{
$receiver_username = $request->Input('receiver_username');
$notificationCount = DB::table('notifications')->where('receiver_username', '=', Auth::user()->username)->count();
$results = DB::table('notifications')->where('receiver_username', '=', Auth::user()->username)->get();
return view('ajax.notification')->with('notificationCount', $notificationCount)->with('results', $results);
}
示例9: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$buscar = $request->Input('buscar');
$renglon = DB::table('renglones')->join('tipo_renglones', 'renglones.id_tipo_renglon', '=', 'tipo_renglones.id_tipo_renglon')->join('marca', 'renglones.id_marca', '=', 'marca.id_marca')->join('modelo', 'renglones.id_modelo', '=', 'modelo.id_modelo')->select('renglones.*', 'tipo_renglones.descrip_tipo_renglon', 'marca.descrip_marca', 'modelo.descrip_modelo')->where('descrip_renglon', 'LIKE', '%' . $buscar . '%')->where('renglones.id_almacen', '=', Auth::User()->id_almacen)->paginate(5);
$renglon->setPath('renglones');
return view('renglon.index')->with(['renglones' => $renglon]);
}
示例10: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(Request $request)
{
$buscar = $request->Input('buscar');
$trenglon = \App\TipoRenglon::where('descrip_tipo_renglon', 'LIKE', '%' . $buscar . '%')->where('id_almacen', '=', Auth::User()->id_almacen)->paginate(5);
$trenglon->setPath('tiporenglon');
return view('tiporenglon.index')->with('trenglon', $trenglon);
}
示例11: signupAction
public function signupAction(Request $request)
{
//注册
$username = $request->Input('username');
$password = $request->Input('password');
$email = $request->Input('email');
$rules = ['name' => 'required|min:4', 'password' => 'required|min:8', 'email' => 'required|email|unique:users'];
$valid = Validator::make(['name' => $username, 'password' => $password, 'email' => $email], $rules);
if ($valid->fails()) {
return response()->json($valid->messages()->first());
} else {
$data = ['name' => $username, 'password' => bcrypt($password), 'email' => $email, 'created_at' => time(), 'updated_at' => time(), 'role' => 0];
$user = User::create($data);
return response()->json(true);
}
return response()->json(false);
}
示例12: submitEditTitle
public function submitEditTitle(Request $request, $id)
{
$datas = titles::findOrFail($id);
$datas->test_title = $request->Input('test_title');
$datas->test_description = $request->Input('title_description');
$datas->status = $request->Input('status');
$datas->save();
return back()->withInput();
}
示例13: removeKey
public function removeKey(Request $request, $id)
{
$keyId = $request->Input('key_id');
$key = Key::find($keyId);
$key->delete();
return Redirect::route('contractors.show', $id);
}
示例14: getPaginateTable
public function getPaginateTable(Request $request)
{
$sample = Sample::where('id', 'LIKE', '%' . $request->Input('id') . '%')->where('CustomerName', 'LIKE', '%' . $request->Input('name') . '%')->where('DatePurchase', 'LIKE', '%' . $request->Input('date') . '%')->count();
$totalPage = ceil($sample / 30);
return $totalPage;
}
示例15: update
/**
* Update the specified resource in storage.
* @param type int $id
* @param type Groups $group
* @param type Request $request
* @return type Response
*/
public function update($id, Groups $group, Request $request)
{
$var = $group->whereId($id)->first();
//Updating Status
$status = $request->Input('group_status');
$var->group_status = $status;
//Updating can_create_ticket field
$createTicket = $request->Input('can_create_ticket');
$var->can_create_ticket = $createTicket;
//Updating can_edit_ticket field
$editTicket = $request->Input('can_edit_ticket');
$var->can_edit_ticket = $editTicket;
//Updating can_post_ticket field
$postTicket = $request->Input('can_post_ticket');
$var->can_post_ticket = $postTicket;
//Updating can_close_ticket field
$closeTicket = $request->Input('can_close_ticket');
$var->can_close_ticket = $closeTicket;
//Updating can_assign_ticket field
$assignTicket = $request->Input('can_assign_ticket');
$var->can_assign_ticket = $assignTicket;
//Updating can_trasfer_ticket field
$trasferTicket = $request->Input('can_trasfer_ticket');
$var->can_trasfer_ticket = $trasferTicket;
//Updating can_delete_ticket field
$deleteTicket = $request->Input('can_delete_ticket');
$var->can_delete_ticket = $deleteTicket;
//Updating can_ban_email field
$banEmail = $request->Input('can_ban_email');
$var->can_ban_email = $banEmail;
//Updating can_manage_canned field
$manageCanned = $request->Input('can_manage_canned');
$var->can_manage_canned = $manageCanned;
//Updating can_manage_faq field
$manageFaq = $request->Input('can_manage_faq');
$var->can_manage_faq = $manageFaq;
//Updating can_view_agent_stats field
$viewAgentStats = $request->Input('can_view_agent_stats');
$var->can_view_agent_stats = $viewAgentStats;
//Updating department_access field
$departmentAccess = $request->Input('department_access');
$var->department_access = $departmentAccess;
//Updating admin_notes field
$adminNotes = $request->Input('admin_notes');
$var->admin_notes = $adminNotes;
/* Check whether function success or not */
try {
$var->save();
/* redirect to Index page with Success Message */
return redirect('groups')->with('success', 'Group Updated Successfully');
} catch (Exception $e) {
/* redirect to Index page with Fails Message */
return redirect('groups')->with('fails', 'Groups can not Create' . '<li>' . $e->errorInfo[2] . '</li>');
}
}