Questions tagged [laravel-response]
53 questions
0
votes
3 answers
laravel 5.5 model relation in json
I'm trying to understand, if in laravel 5.5 there is a method that given a model linked to another with an external key, I can obtain the result of the complete join of the attributes of both models. I wanto to avoid to return two models and merge…

Jonio
- 1,213
- 2
- 15
- 35
0
votes
1 answer
Does formatErrors not working anymore in Laravel 5.5?
I have following code in my Request class that returns custom messages.
public function formatErrors(\Illuminate\Contracts\Validation\Validator $validator) {
if($validator->fails()) {
$validator->errors()->add('Message', "Validation…

Pankaj
- 9,749
- 32
- 139
- 283
0
votes
6 answers
Laravel 5.5 - Only log 500 error, never send error details via api?
I made the below controller to demonstrate the issue of handling 500 errors I am having with the api. I want to be able to detect when a 500 error will be thrown so it never makes it to the client (as it is too much details to share with the client…

Wonka
- 8,244
- 21
- 73
- 121
0
votes
1 answer
Laravel: accessing url multiple time with different parameter returns wrong data
The view of my application post data to controller with a parameter in URL. The URL is like
xxxx/admin/shipments/edit/50
It means I am editing the shipment having shipment_id = 50. but when user uses the application after certain time instead…

Nauman Khalid
- 852
- 9
- 15
0
votes
0 answers
Laravel - BindingResolutionExceptionUnresolvable dependency resolving [Parameter #0 [ $method ]] in class GuzzleHttp\Psr7\Request
I'm unable to accept post request in Laravel because of following exception
BindingResolutionException in Container.php line 819:
Unresolvable dependency resolving [Parameter #0 [ $method ]] in class GuzzleHttp\Psr7\Request
Before…

Gaurav Deshpande
- 141
- 1
- 1
- 6
0
votes
3 answers
How to handle native exception in Laravel?
For example, I use:
return User::findOrFail($id);
When row does not exist with $id I get exception.
How I can return this exception in Json response? It returns HTML Laravel page now.
I need something like as:
{"error", "No query results for…

Dev
- 1,013
- 7
- 15
- 37
0
votes
0 answers
laravel view and data loading to view
i have a route defined in my route.php file like this:
Route::get('{username}/{search_term}', 'userProfileSearchController@search');
in my controller i retrieve the user model from db by the username and then performing a search query for finding…

Aria
- 45
- 9
0
votes
1 answer
Error opening pdf laravel (not display correctly in browser)
I am having problems opening an existing pdf from a directory in laravel. The code works perfectly with pure PHP, but taking it to laravel not work properly because it does not display correctly in the browser, it looks like this:
%PDF-1.5 3 0 obj…

D3vilRemix
- 9
- 2
- 6