Lesson list · Lesson 4 of 5

The Basics · Lesson 4 of 5

Blade Templates

Show data in your pages safely, with loops and conditions.

1 min 0 comments

Blade lets you mix HTML with data. Double curly braces print a value and escape it, so text typed by users cannot inject scripts.

<h1>{{ $post->title }}</h1>

@foreach ($post->comments as $comment)
  <p>{{ $comment->body }}</p>
@endforeach

Layouts

Put the parts every page shares (the header and footer) in one layout, and let each page fill in only its own content.

Discussion

Log in to join the conversation. Log in

No discussion here yet. Be the first to ask.