قالب Blade
ساخت UI با سینتکس تمیز.
نمایش داده و حلقه
Blade
<h1>{{ $title }}</h1>
@foreach ($posts as $post)
<article>
<h2>{{ $post->title }}</h2>
<p>{{ Str::limit($post->body, 100) }}</p>
</article>
@empty
<p>پستی نیست.</p>
@endforeachLayout و بخشها
layouts/app.blade.php
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<title>@yield('title', 'سایت من')</title>
</head>
<body>
@include('partials.nav')
@yield('content')
</body>
</html>posts/index.blade.php
@extends('layouts.app')
@section('title', 'لیست پستها')
@section('content')
<h1>پستها</h1>
...
@endsectionفرم و CSRF
Blade
<form method="POST" action="{{ route('posts.store') }}">
@csrf
<input type="text" name="title">
<button type="submit">ذخیره</button>
</form>