Created
July 5, 2020 15:19
-
-
Save DuudeXX8/32cc7617dfafefc75633b6f24e7421f8 to your computer and use it in GitHub Desktop.
Response in laravel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ОтветыJSОN преобразуют передаваемые данные в формат JSON (с помощью метода jsoп_eпcode()) | |
и присваивают заголовку Сопtепt-Туре значение applicatioп/ json. | |
При желании можно создавать ответ не в формате.JSОN, а в форматеJSОNР, | |
применяя метод setCallback(), как показано в примере 10.10 | |
Пример 10.10. Использование типа ответа jsoп() | |
puЫic function contacts() { | |
return response()->json(Contact::all()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment