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
Sometimes your templates also need some logic, for example, only if certain condition is true, you
want to display some content.
This condition might, for example, be that the current user is logged in in Blade.
You can achieve that using directive's if directives reflect the way you would achieve it using plain
ppy if control structure.
First, let's add a new property to our dummy posts array, let's call this property is new and send
it to true for the first block post.
And two falls in the second blog post.
Go to the template responsible for displaying our blog post.
To render content based on a condition, we will use the if directive.
The condition here goes within parenthesis.
So let's check if Post is new is actually true.
The if statement in Blade is closed by a corresponding and if directive.
Now, if the above condition is true, everything inside the directive will be rendered, otherwise
it will not.
So let's add something, our development saying our new blog post using if, say, the changes, and
let's switch back to the browser to verify that this actually works.
Notice I've zoomed in a little bit around four times.
Let's refresh this blog post.
And indeed, we see that this is our new blog post.
Check the second one.
And this text is not present.
For alternative cases, you can use El's if or the ALS directive exactly like you'd be.
Let's try displaying alternative message with Ifirst.
So else if the condition goes inside parenthesis, so let's try the negative post is underscore new
and let's render a message blog post is old using URLs if.
Save the changes and let's go to the browser, so that's a blog post one.
And in the second one, we indeed see the alternative message.
Now, that's a simple case because the Post is new, is actually a Bolian, so we don't really need
as if just showing you that you can use it in other scenarios, maybe in this one.
Actually, the better way is to just add an alert directive.
So just the opposite case.
Say the changes again and let's verify that it still works.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.