Laravel API 404 Error: Customize Exception Message

Laravel API 404 Error: Customize Exception Message

Laravel Daily

2 года назад

23,933 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

tom jerry
tom jerry - 15.09.2023 14:15

if someone forgots to put accep: application/json on the header, can we do this? - create a middleware and add accept: application/json on the header and apply that middleware to all api. is this way right?

Ответить
Alexandre Soffiatti Santos
Alexandre Soffiatti Santos - 25.05.2023 04:34

I have a doubt. How could I use this in a test. In order to improve the quality of my application ?

Ответить
Hadayat Niazi
Hadayat Niazi - 28.03.2023 02:57

You are legend

Ответить
Semicolon
Semicolon - 20.03.2023 20:16

Thanks

Ответить
Alexandre Soffiatti Santos
Alexandre Soffiatti Santos - 28.12.2022 20:39

I have a question. How I can return a json in laravel api, if user is not authenticated ? I use laravel Sactum

Ответить
Mr Bakhtishod
Mr Bakhtishod - 22.12.2022 16:17

Thanks bro:)

Ответить
alex prezmon
alex prezmon - 22.10.2022 02:56

Thanks for the video. I'm having trouble trying to implement this. I did exactly what you did and always get this response in Postman:
"message": "Attempt to read property \"id\" on null",
"exception": "ErrorException",
What should I do. Thank you.

Ответить
Ali Neisi
Ali Neisi - 14.09.2022 14:06

Thx man 🔥

Ответить
Parimal Bhattarai
Parimal Bhattarai - 13.08.2022 13:16

if we have get /users/{id}/roles/{role_id}, object not found does not provide enough info like weather role is not found or user not found ? how can we solve this ?

Ответить
Thủy Thanh Vô Ngư
Thủy Thanh Vô Ngư - 22.06.2022 07:29

it worked, thank you

Ответить
::INITER::37::37::
::INITER::37::37:: - 11.06.2022 15:52

$validate=$request->validate([
"name"=>['required','min:3','max:255'],
"hobby"=>['required','min:3','max:255'],
"address"=>['required','min:3','max:255']
]);
how to make response json if the validate is error
example if the input filed name is "ab" i want to make response json (message => "name field must more than 3 character") how can i do that in laravel 9 ?

Ответить
Eduard Espinoza
Eduard Espinoza - 13.04.2022 23:37

You are god, but for now only some know.

Ответить
Isuru Ranawaka
Isuru Ranawaka - 18.02.2022 15:42

Thanks for the tutorial. Helped me in my production app.

Ответить
RibosoMatic Code
RibosoMatic Code - 13.02.2022 21:15

Práctico y al punto! Me sirvio mucho. Gracias

Ответить
ward
ward - 05.01.2022 23:42

Let's face it, there's no need to try to hide your backend framework, it's just too easy to detect either way. It's a small hurdle, at best.

Ответить
Deividson Damasio
Deividson Damasio - 17.12.2021 23:06

Thank you! 👍

Ответить
Marcelo Marin Salvagiot
Marcelo Marin Salvagiot - 16.12.2021 02:44

Another aproche, if you use try catch you can catch the specific model not found exception, and then customize the return message

Ответить
Pratik Desai
Pratik Desai - 24.11.2021 17:12

Thanks a lot..you solving my problem

Ответить