How to change value of a request parameter in laravel

Try to: $requestData = $request->all(); $requestData[‘img’] = $img; Another way to do it: $request->merge([‘img’ => $img]); Thanks to @JoelHinz for this. If you want to add or overwrite nested data: $data[‘some’][‘thing’] = ‘value’; $request->merge($data); If you do not inject Request $request object, you can use the global request() helper or \Request:: facade instead of $request

Laravel Pagination links not including other GET parameters

I think you should use this code in Laravel version 5+. Also this will work not only with parameter page but also with any other parameter(s): $users->appends(request()->input())->links(); Personally, I try to avoid using Facades as much as I can. Using global helper functions is less code and much elegant. UPDATE: Do not use Input Facade … Read more

Best Practices for Laravel 4 Helpers and Basic Functions?

The ugly, lazy and awful way: At the end of bootstrap/start.php , add an include(‘tools.php’) and place your function in that new file. The clean way: Create a library. That way it’ll be autoloaded ONLY when you actually use it. Create a libraries folder inside your app folder Create your library file, create a class … Read more

Laravel – Route::resource vs Route::controller

RESTful Resource controller A RESTful resource controller sets up some default routes for you and even names them. Route::resource(‘users’, ‘UsersController’); Gives you these named routes: Verb Path Action Route Name GET /users index users.index GET /users/create create users.create POST /users store users.store GET /users/{user} show users.show GET /users/{user}/edit edit users.edit PUT|PATCH /users/{user} update users.update DELETE … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)