Как справиться с форматом API Laravel ⇐ Php

Кемеровские программисты php общаются здесь
Anonymous
Как справиться с форматом API Laravel

Сообщение Anonymous »

Я планирую форматировать все ответы API на следующий формат: < /p>
// for success response
{
success: true,
data: ...
}
< /code>
// for error response
{
success: false
message: ...
errors: ....
}
< /code>
With api success, it's quite simple because I can control them. But with errors like form request validate, exception 4xx, 5xx... then Laravel will handle so I don't know how to handle all of it.
Is there any way to achieve this?

Подробнее здесь: https://stackoverflow.com/questions/795 ... api-format

Вернуться в «Php»