本文整理汇总了PHP中Illuminate\Support\Facades\Request::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::all方法的具体用法?PHP Request::all怎么用?PHP Request::all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Request
的用法示例。
在下文中一共展示了Request::all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
$inputs = Request::all();
$reglas = array('nombre' => 'required', 'correo' => 'email', 'comentarios' => 'required|max:300');
$mensajes = array('required' => trans('error.requerido'), 'email' => trans('error.correo'));
$validar = Validator::make($inputs, $reglas, $mensajes);
if ($validar->fails()) {
//return back('#gracias')->withErrors($validar)->withInput();
return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '#about')->withErrors($validar)->withInput();
} else {
$contacto = new Contacto();
$contacto->email = Request::get('correo');
$contacto->save();
$contactName = Request::get('nombre');
$contactEmail = Request::get('correo');
$contactMessage = Request::get('comentarios');
$contactAddres = Request::get('direccion');
$data = array('name' => $contactName, 'email' => $contactEmail, 'description' => $contactMessage, 'addres' => $contactAddres);
Mail::send('layouts.email', $data, function ($message) use($contactEmail, $contactName) {
$message->from($contactEmail, $contactName);
$message->to('contacto@fundacionvivemejor.org', 'Contacto Fundacion Vive Mejor')->subject('Solicitud vía WEB');
$message->cc($contactEmail, $contactName);
});
return Redirect::to(\LaravelLocalization::getCurrentLocale() . '/' . trans('menu.contacto') . '?gracias#gracias');
}
}
示例2: addNewItem
public function addNewItem()
{
$aSession = \Session::all();
$aRequest = Request::all();
if (isset($aRequest['food_picture'])) {
$oImage = $aRequest['food_picture'];
$FullImagePath = $this->uploadImage($oImage, 'food_picture');
if (empty($FullImagePath)) {
return view('pages.addItemPage')->withErrors('Image wasn\'t uploaded');
}
}
$aItemParams = array('name' => 'r', 'type' => 'n', 'description' => 'n', 'price' => 'r', 'calories' => 'n', 'status' => 'n', 'spicy' => 'n', 'healthy' => 'n');
//Here i am going to handle the required params of table
foreach ($aItemParams as $sParam => $sCond) {
if ($sCond == 'r') {
if (!isset($aRequest['food_' . $sParam])) {
//Send it back to the factory ;)
}
}
if (isset($aRequest['food_' . $sParam])) {
$aItem[$sParam] = $aRequest['food_' . $sParam];
}
}
$aItem['id_restaurant'] = $aSession['id_user'];
$aItem['picture'] = $FullImagePath;
$aItem['type'] = "not spcified";
//dd($aItem);
if (DB::table('food')->insert($aItem)) {
return Redirect::back();
} else {
return view('/pages.addItemPage')->withErrors("Something is wrong, we are sorry ! :( ");
}
}
示例3: login
/**
* POST /api/login
*/
public function login()
{
// Get all data send in post
$loginFormData = Request::all();
// Create rules for the validator
$validator = Validator::make($loginFormData, ['user_email' => 'required|email', 'user_password' => 'required']);
// If validator fails return a 404 response
if ($validator->fails()) {
return Response::json(['status_code' => 404, 'errors' => $validator->errors()->all()], 404);
}
$user = User::where('email', '=', strtolower($loginFormData['user_email']))->first();
if (!$user) {
return Response::json(['status_code' => 404, 'errors' => ['Votre compte est introuvable dans notre base de donnée.']], 404);
} else {
if ($user->activated == 0) {
return Response::json(['status_code' => 404, 'errors' => ["Merci d'activer votre compte."]], 404);
} else {
if (!Hash::check($loginFormData['user_password'], $user->password)) {
return Response::json(['status_code' => 404, 'errors' => ["Votre mot de passe est incorrect."]], 404);
}
}
}
$room = Room::find($user->room_id);
$partner = User::find($user->is_partner ? $room->user_id : $room->partner_id);
if ($partner->activated == 0) {
return Response::json(['status_code' => 404, 'errors' => ["Le compte de votre partenaire n'a pas été activé."]], 404);
}
// Success
return Response::json(['status_code' => 200, 'success' => "Login success", 'data' => ['me' => $user, 'partner' => $partner, 'room' => $room]]);
}
示例4: store
public function store()
{
$preferences = Request::all();
$response = new Response('OK');
$response->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_AMOUNT, $preferences['amount'], PreferencesVO::PREFERENCES_LIFESPAN))->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_PERIOD, $preferences['period'], PreferencesVO::PREFERENCES_LIFESPAN))->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_TAXCDB, $preferences['taxcdb'], PreferencesVO::PREFERENCES_LIFESPAN))->withCookie(Cookie::forever(PreferencesVO::PREFERENCES_TAXLCI, $preferences['taxlci'], PreferencesVO::PREFERENCES_LIFESPAN));
return $response;
}
示例5: index
public function index()
{
$objRegisters = new Registers();
$limit = 50;
$request = Request::all();
$page = isset($request['page']) ? $request['page'] : 1;
$order = isset($request['order']) ? $request['order'] : 'asc';
$sort = isset($request['sort']) ? $request['sort'] : '';
$start = $page * $limit - $limit;
if (isset($request['name'])) {
$objRegisters = $objRegisters->where('name', 'like', '%' . $request['name'] . '%');
}
$paging = $objRegisters->paginate($limit);
switch ($sort) {
case 'name':
$objRegisters = $objRegisters->orderBy('name', $order);
break;
case 'status':
$objRegisters = $objRegisters->orderBy('status', $order);
break;
default:
$objRegisters = $objRegisters->orderBy('id', 'DESC');
break;
}
$list = $objRegisters->skip($start)->take($limit)->get();
$title = 'List Registers';
return view('registers::index', array('paging' => $paging, 'listdata' => $list, 'start' => $start, 'request' => $request, 'title' => $title));
}
示例6: update
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update(EditCompanyRequest $request, $id)
{
$company = Company::findOrFail($id);
$company->fill(Request::all());
$company->save();
return redirect()->route('settings.company.index');
}
示例7: afterRegistered
public function afterRegistered()
{
$this->response = lego_register(ResponseData::class, function () {
$items = call_user_func_array($this->data(), [Request::get(self::KEYWORD_KEY), Request::all()]);
return self::result($items);
}, $this->name);
}
示例8: getItemChildren
function getItemChildren(RequestFacade $request)
{
$itemsManager = new ItemsManager();
$path = RequestFacade::all()['path'];
$children = $itemsManager->getItemChildren($path);
return $this->jsonResponse($children);
}
示例9: update
public function update($id)
{
$user = User::findOrFail($id);
$user->fill(Request::all());
$user->save();
return redirect()->route('admin.usuario.index');
}
示例10: register
/**
* Register the application services.
*
* @return void
*/
public function register()
{
$configPath = __DIR__ . '/../config/sql-logging.php';
$this->mergeConfigFrom($configPath, 'sql-logging');
if (config('sql-logging.log', false)) {
Event::listen('illuminate.query', function ($query, $bindings, $time) {
$data = compact('bindings', 'time');
// Format binding data for sql insertion
foreach ($bindings as $i => $binding) {
if ($binding instanceof \DateTime) {
$bindings[$i] = $binding->format('\'Y-m-d H:i:s\'');
} else {
if (is_string($binding)) {
$bindings[$i] = "'{$binding}'";
}
}
}
// Insert bindings into query
$query = str_replace(array('%', '?'), array('%%', '%s'), $query);
$query = vsprintf($query, $bindings);
$log = new Logger('sql');
$log->pushHandler(new StreamHandler(storage_path() . '/logs/sql-' . date('Y-m-d') . '.log', Logger::INFO));
// if log request data
if (config('sql-logging.log_request', false)) {
$data['request_path'] = Request::path();
$data['request_method'] = Request::method();
$data['request_data'] = Request::all();
}
// add records to the log
$log->addInfo($query, $data);
});
}
}
示例11: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$dataUpdate = Request::all();
$data = table_hashtag::find($id);
$data->update($dataUpdate);
return redirect('admin/hashtag')->with('message', 'Data successfully changed!');
}
示例12: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$dataUpdate = Request::all();
$data = table_project::find($id);
$data->update($dataUpdate);
return redirect('admin/project')->with('message', 'Data berhasil dirubah!');
}
示例13: anyIndex
public function anyIndex()
{
//获取路由传入的参数
//echo Route::input('name');
//获取配置信息
$value = config('app.timezone');
//var_dump($value);
//获取请求输入 http://host-8/web/user?name=dfse 输出:dfse
$name1 = Request::has('name') ? Request::get('name') : '';
//取得特定输入数据,若没有则取得默认值
$name2 = Request::input('name', '默认值');
$input = Request::all();
//所有的
$input = Request::input('products.0.name');
//重定向
//return redirect('login');
//获取cookie
$value = Request::cookie('name');
//获取域名
$url = Request::root();
// echo $url;
$data = ['url' => $url, 'name1' => $name1, 'name2' => $name2, 'value' => $value];
//响应视图 响应最常用的几个方法:make/view/json/download/redirectTo
return response()->view('user.user', $data);
}
示例14: update
public function update(EditAsignaturasCursadasRequest $request, $id)
{
$cursadas = AsignaturaCursada::findOrFail($id);
$cursadas->fill(Request::all());
$cursadas > save();
return redirect()->route('asignaturas.cursadas.index');
}
示例15: createUsers
public function createUsers()
{
$inputs = Request::all();
$userTypes = Request::get('userType');
// Checking permission of user before creating new users
$emails = json_decode(Request::input('users'));
foreach ($emails as $email) {
Log::info('username - ' . $email);
$password = str_random(10);
DB::table('users')->insert(['name' => $email, 'email' => $email, 'password' => bcrypt($password), 'type' => 'caller']);
foreach ($userTypes as $userType) {
// Making a 'userType' user
$user = \App\User::where('name', '=', $email)->first();
$caller = \App\Role::where('name', '=', $userType)->first();
// role attach alias
$user->attachRole($caller);
// parameter can be an Role object, array, or id
}
$data = array('name' => $email, 'username' => $email, 'password' => $password);
// Would sent a link to the user to activate his account
// $this->sendLink($email);
// \Mail::send('mail.email', $data, function ($message) use ($data) {
// $message->subject('Login Details ')
// ->to('manish.dwibedy@gmail.com');
// });
}
return view('create-users', ['page' => 'create-users']);
}