Afrikaans
Akan
Albanian
Amharic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Apart from returning the text or a view rendered using blade templates, Laravel has ways to build our
proper HTP response with all its features like response codes, setting cookies and setting response
headers.
For the purpose of this lecture, let's create Adami route with the fun slash responses you are I.
Now, a lot of the way is to use its helper functions, the response function will create a new response
object.
This object has methods like header or kookie.
The response function accepts the free parameters, all optional, first is the content to return.
Second, the status code and third is an array of response headers.
So why won't we return the Post's variable that we actually have in this file?
But first, we need to use it for this function.
So posts will be a content.
Let's change the status codes to something else, maybe two hundred one and let's leave the headers
empty.
There, Heather Medalled says the response header like contents typed, for example, tying the browser
what to expect from their content, whether it is HTML or JSON.
So let's return something that would be understood as Jason.
Now, Cookie says the browser cookies.
Cookies are useful to keep users specific data on the browser side.
This is used to implement features like User Session or are Remember Me feature of a logged in user.
So let's set an example, Cookie with that.
My cookie name, the value being my name and the cookie should expire after three thousand six hundred
minutes, which is one hour.
Now, let's get back to the status codes in all responses returned to status code, these codes have
meaning the most common across the web is 200, meaning OK for all four meaning not found and 500,
which is internal server error.
Though with traditional websites, you'd rarely see anything but those free above when developing API
is the full spectrum is useful.
Take a look at the link from the Amde N.
To read more about all the possible codes that you might use and encounter.
So how using the response helper is different from using the view helper function, you might ask?
When and why you should use which?
That is simple use response helper when you need to do something extra, like setting a header or a
cookie or change the response status code, by the way, the response helper function creates a response
object, which also has the view method, which accepts exactly the same arguments as this separate
view helper function.
So you can also render blade views while adding headers cookies and changing the status code.
There is also a simpler way to return Jassam done adding content type header explicitly, but will get
to it in a couple lectures.
Finally, let's see this in action heat, this farm slash response, says Eurorail in the browser,
you won't see anything special, but if you open the network tab, you can see a different response
code to the one we've sent all called response header.
Is there the content type that we have said to application Jason and the cookie we've created called
my cookie, which you can also verify in application type cookies on the left and during this?
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.