Комментарии:
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?
ОтветитьI have a doubt. How could I use this in a test. In order to improve the quality of my application ?
ОтветитьYou are legend
ОтветитьThanks
ОтветитьI have a question. How I can return a json in laravel api, if user is not authenticated ? I use laravel Sactum
ОтветитьThanks bro:)
Ответить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.
Thx man 🔥
Ответить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 ?
Ответитьit worked, thank you
Ответить$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 ?
You are god, but for now only some know.
ОтветитьThanks for the tutorial. Helped me in my production app.
ОтветитьPráctico y al punto! Me sirvio mucho. Gracias
Ответить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.
ОтветитьThank you! 👍
ОтветитьAnother aproche, if you use try catch you can catch the specific model not found exception, and then customize the return message
ОтветитьThanks a lot..you solving my problem
Ответить