Join Joseph Lowery for an in-depth discussion in this video Asserting conditional control, part of Laravel 4 Essential Training.
- View Offline
- Exercise Files
- Conditional statements keep templates…flexible and responsive,…whether you're talking a basic if-else statement,…a do-while type loop,…or the uniquely Laravel unless statement.…Blade has all the power you need…to execute a wide range of conditional,…or, as they are sometimes called,…control statements.…Let me introduce you to a few of them.…We'll start with a basic if-else condition.…I'm going to start the ball rolling…by adding a second variable to my array…in my HomeController.php file.…
I'll put it right after…the location is equal to New York City,…put in a comma,…and then let's set a new variable.…We'll call this one theWeather.…We will say that one is sunny.…Going to save the file,…and then switch to hello.blade.php.…Let me open up my div again…and scroll down to the bottom.…The Blade syntax for if-else statements…is really simplicity itself.…
You preface each condition…with an @ sign,…and you're pretty much good to go.…It's @if theWeather,…which checks to see if such a variable exists…with a true value,…and if so, it'll pass that variable in.…
Need a quick dive into Laravel? Check out this short primer, Up and Running with Laravel.
- Installing Laravel and Composer
- Routing requests
- Filtering routes
- Incorporating advanced controllers
- Creating a basic Blade template
- Developing a layout with child pages and forms
- Integrating a database
- Creating tables via migrations
- Outputting data
- Building a Laravel app
- Authenticating users
- Deploying Laravel code
Skill Level Intermediate
1. Introduction to Laravel
2. Fundamental Laravel Concepts
3. Outputting Laravel Code
4. Integrating Databases
5. Querying Data with Eloquent ORM
6. Building a Laravel App
7. Deploying Your Laravel Code
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.