{"id":107863,"date":"2023-11-21T00:44:17","date_gmt":"2023-11-21T05:44:17","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/?p=107863"},"modified":"2025-03-17T10:23:40","modified_gmt":"2025-03-17T14:23:40","slug":"laravel-blade-basics","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/","title":{"rendered":"Laravel Blade Basics"},"content":{"rendered":"<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"538\" src=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade-1024x538.png\" alt=\"Laravel Blade Basics\" class=\"wp-image-107977\" srcset=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade-1024x538.png 1024w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade-300x158.png 300w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade-768x403.png 768w, https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png 1200w\" sizes=\"auto, (min-width: 1360px) 876px, (min-width: 960px) calc(61.58vw + 51px), calc(100vw - 80px)\" \/><\/figure>\n\n\n\n<p><a href=\"https:\/\/laravel.com\/docs\/10.x\/blade\" target=\"_blank\" rel=\"noreferrer noopener\">Laravel Blade<\/a>, the framework\u2019s built-in templating engine, makes it easy to blend PHP with HTML. This seamless integration simplifies building dynamic web interfaces, making Blade a key feature of Laravel.<\/p>\n\n\n\n<p>In this comprehensive guide, we\u2019ll dive into Blade\u2019s fundamentals, equipping you with the knowledge to craft responsive and interactive web pages easily.<\/p>\n\n\n\n<p class=\"alert alert-info\">Choose from our\u00a0<a href=\"https:\/\/www.inmotionhosting.com\/laravel-hosting\">Laravel Hosting<\/a>,\u00a0<a href=\"https:\/\/www.inmotionhosting.com\/vps-hosting\">VPS Hosting<\/a>, or\u00a0<a href=\"https:\/\/www.inmotionhosting.com\/dedicated-servers\">Dedicated Servers<\/a>\u00a0to host your Laravel applications and websites today!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"intro\">What is Blade?<\/h2>\n\n\n\n<p>Blade is a templating engine that comes bundled with Laravel. Unlike traditional PHP templates, Blade templates are compiled into plain PHP code and cached for optimal performance. Blade offers a cleaner and more concise syntax for embedding PHP code in HTML and provides a range of helpful directives for common tasks.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"setting-up\">Setting Up a Blade Template<\/h2>\n\n\n\n<p>Blade templates are identified by the <code>.blade.php<\/code> extension and are typically housed in the <code>resources\/views<\/code> directory. Creating a Blade view is as simple as crafting a new file with this extension. Within this file, you can seamlessly blend HTML and Blade syntax. When it\u2019s time to display a Blade view, Laravel\u2019s <code>view()<\/code> function comes into play, rendering the template with any necessary data.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"routing\">Routing to a Blade Template<\/h2>\n\n\n\n<p>Routing in Laravel is the process of directing HTTP requests to specific controllers or closures. To display a Blade template, you first define a route in the <code>routes\/web.php<\/code> file. For example:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"Route::get('\/welcome', function () {\n    return view('welcome');\n});\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #79B8FF\">Route<\/span><span style=\"color: #F97583\">::<\/span><span style=\"color: #B392F0\">get<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'\/welcome'<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #E1E4E8\"> () {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">view<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'welcome'<\/span><span style=\"color: #E1E4E8\">);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">});<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>This route uses a closure to return the <code>welcome.blade.php<\/code> view when the <code>\/welcome<\/code> URL is accessed. Laravel\u2019s routing system is incredibly flexible, allowing data to be passed to views, route parameters, and controllers.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"Route::get('\/about', function () {\n    return view('welcome', ['title' =&gt; 'Welcome!', 'name' =&gt; 'User']);\n});\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #79B8FF\">Route<\/span><span style=\"color: #F97583\">::<\/span><span style=\"color: #B392F0\">get<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'\/about'<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #F97583\">function<\/span><span style=\"color: #E1E4E8\"> () {<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">return<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #B392F0\">view<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'welcome'<\/span><span style=\"color: #E1E4E8\">, [<\/span><span style=\"color: #9ECBFF\">'title'<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'Welcome!'<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">'name'<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">=&gt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #9ECBFF\">'User'<\/span><span style=\"color: #E1E4E8\">]);<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">});<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, we are passing an array with <code>title<\/code> and <code>name<\/code> to the <code>welcome.blade.php<\/code> view.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"syntax\">Blade Syntax Basics<\/h2>\n\n\n\n<p>Blade simplifies embedding PHP in HTML. For instance, <code>{{ $variable }}<\/code> displays a variable, with Blade handling HTML entity escaping. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">welcome.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;! DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n  &lt;title&gt;{{ $title }}&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n  &lt;h1&gt;Welcome {{ $name }}!&lt;h1&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;!<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">DOCTYPE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #E1E4E8\">{{ $title }}<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">Welcome<\/span><span style=\"color: #E1E4E8\"> {{ $name }}<\/span><span style=\"color: #F97583\">!&lt;<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>As you can see in this example, we are using the <code>title<\/code> and <code>name<\/code> variables that were passed to the view. <\/p>\n\n\n\n<p>Control structures like <code>@if<\/code>, <code>@foreach<\/code>, and <code>@while<\/code> offer readable alternatives to PHP tags, enhancing the clarity of your templates.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"if\">@if and @endif<\/h3>\n\n\n\n<p><code>@if<\/code> and <code>@endif<\/code> allow you to conditionally display content based on certain conditions, similar to how you would use <code>if<\/code> statements in standard PHP code.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"@if($user-&gt;'User')\n  &lt;h1&gt;Welcome Back, User!&lt;\/h1&gt;\n@endif\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">@if<\/span><span style=\"color: #E1E4E8\">($user<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #9ECBFF\">'User'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">Welcome<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Back<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #79B8FF\">User<\/span><span style=\"color: #F97583\">!&lt;\/<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@endif<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, the text \u201cWelcome Back, User!\u201d will only be displayed if the <code>$user<\/code> variable evaluates to <code>User<\/code>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"foreach\">@foreach and @endforeach<\/h3>\n\n\n\n<p><code>@foreach<\/code> and <code>endforeach<\/code> are used for looping over arrays or collections, similar to PHP\u2019s <code>foreach<\/code> loop.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"&lt;ul&gt;\n@foreach($users as $user)\n  &lt;li&gt;{{ $user-&gt;name }}&lt;\/li&gt;\n@endforeach\n&lt;\/ul&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">ul<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@foreach<\/span><span style=\"color: #E1E4E8\">($users <\/span><span style=\"color: #F97583\">as<\/span><span style=\"color: #E1E4E8\"> $user)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">li<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #E1E4E8\">{{ $user<\/span><span style=\"color: #F97583\">-&gt;<\/span><span style=\"color: #E1E4E8\">name }}<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">li<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@endforeach<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">ul<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, the <code>foreach<\/code> loop iterates over a collection of users. For each user in the collection, it creates a list item displaying the user\u2019s name.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"while\">@while and @endwhile<\/h3>\n\n\n\n<p><code>@while<\/code> and <code>@endwhile<\/code> allow you to execute a block of code repeatedly as long as a given condition is true, similar to PHP\u2019s <code>while<\/code> loop. They are particularly useful for iterating through data when the number of iterations is not known beforehand. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span role=\"button\" tabindex=\"0\" data-code=\"@php\n  $count = 0;\n@endphp\n\n&lt;ul&gt;\n@while($count &lt; count($items))\n  &lt;li&gt;{{ $items[$count] }}&lt;\/li&gt;\n  @php $count++; @endphp\n@endwhile\n&lt;\/ul&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">@<\/span><span style=\"color: #79B8FF\">php<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  $count <\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">0<\/span><span style=\"color: #E1E4E8\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@<\/span><span style=\"color: #79B8FF\">endphp<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">ul<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@while<\/span><span style=\"color: #E1E4E8\">($count <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">count<\/span><span style=\"color: #E1E4E8\">($items))<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">li<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #E1E4E8\">{{ $items[$count] }}<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">li<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">  <\/span><span style=\"color: #F97583\">@<\/span><span style=\"color: #79B8FF\">php<\/span><span style=\"color: #E1E4E8\"> $count<\/span><span style=\"color: #F97583\">++<\/span><span style=\"color: #E1E4E8\">; <\/span><span style=\"color: #F97583\">@<\/span><span style=\"color: #79B8FF\">endphp<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@endwhile<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">ul<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, the template creates a list item (<code>&lt;li&gt;<\/code>) for each element in the <code>$items<\/code> array. The <code>$count<\/code> variable is incremented within the loop to eventually break the condition. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"inheritance\">Blade Template Inheritance<\/h2>\n\n\n\n<p>Blade\u2019s template inheritance feature promotes code reusability. By defining a master layout with common elements, you can extend this layout in other views using <code>@extends<\/code>, <code>@section<\/code>, and <code>@yield<\/code>. This DRY approach streamlines view creation and maintains consistency across your application.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"master-layout\">Creating a Master Layout<\/h3>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/layouts\/master.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;App Name - @yield('title')&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;header&gt;\n        &lt;!-- Header content --&gt;\n    &lt;\/header&gt;\n\n    &lt;div class=&quot;container&quot;&gt;\n        @yield('content')\n    &lt;\/div&gt;\n\n    &lt;footer&gt;\n        &lt;!-- Footer content --&gt;\n    &lt;\/footer&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;!<\/span><span style=\"color: #79B8FF\">DOCTYPE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">App<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Name<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">@yield<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'title'<\/span><span style=\"color: #E1E4E8\">)<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">&lt;!--<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Header<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">content<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">div<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">class=<\/span><span style=\"color: #9ECBFF\">\"container\"<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">@yield<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'content'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">div<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">footer<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">&lt;!--<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Footer<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">content<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">footer<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this layout, <code>@yield('title')<\/code> and <code>@yield('content')<\/code> are placeholders for content that will be filled by the child views.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"child-views\">Extending the Master Layout in Child Views<\/h3>\n\n\n\n<p>Once you have a master layout, you can create individual views that extend this layout. To do this, use the <code>@extends<\/code> directive. Within these child views, you define sections (<code>@section<\/code>) that correspond to the <code>@yield<\/code> directives in the master layout. <\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/pages\/home.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"@extends('layouts.master')\n\n@section('title', 'Home Page')\n\n@section('content')\n    &lt;h1&gt;Welcome to Our Application&lt;\/h1&gt;\n    &lt;p&gt;This is the home page.&lt;\/p&gt;\n@endsection\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">@<\/span><span style=\"color: #B392F0\">extends<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'layouts.master'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@<\/span><span style=\"color: #B392F0\">section<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'title'<\/span><span style=\"color: #E1E4E8\">, <\/span><span style=\"color: #9ECBFF\">'Home Page'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@<\/span><span style=\"color: #B392F0\">section<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'content'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">Welcome<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">to<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Our<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Application<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">This<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">is<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">the<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">home<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">page<\/span><span style=\"color: #F97583\">.<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">@<\/span><span style=\"color: #79B8FF\">endsection<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, the <code>@extends('layouts.master')<\/code> directive tells Blade that this view should inherit the master layout. The <code>@section('title', 'Home Page')<\/code> and <code>@section('content')<\/code> directives fill in the <code>@yield('title')<\/code> and <code>@yield('content')<\/code> sections of the master layout, respectively.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"include\">The @include Directive<\/h2>\n\n\n\n<p>The <code>@include<\/code> directive in Laravel\u2019s Blade templating engine is a simple yet powerful feature for including subviews within a Blade view. It promotes modularity by allowing you to break down views into smaller, reusable parts. This approach is particularly useful for elements that are common across multiple pages, such as headers, footers, or navigation bars.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"subviews\">Creating the Subviews<\/h3>\n\n\n\n<p>First, we create separate Blade files for the header and footer.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/includes\/header.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;header&gt;\n    &lt;h1&gt;My Application&lt;\/h1&gt;\n    &lt;nav&gt;\n        &lt;!-- Navigation links --&gt;\n    &lt;\/nav&gt;\n&lt;\/header&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">My<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Application<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">h1<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">nav<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">&lt;!--<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Navigation<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">links<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">--&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">nav<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">header<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/includes\/footer.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;footer&gt;\n    &lt;p&gt;\u00a9 2023 My Application&lt;\/p&gt;\n&lt;\/footer&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">footer<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">\u00a9<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">2023<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">My<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Application<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">footer<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"including-subviews\">Including the Subviews in a Main View<\/h3>\n\n\n\n<p>Now, we can include these subviews in our main Blade template.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/home.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n    &lt;title&gt;Home Page&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    @include('includes.header')\n\n    &lt;div class=&quot;content&quot;&gt;\n        &lt;p&gt;Welcome to the home page of My Application!&lt;\/p&gt;\n    &lt;\/div&gt;\n\n    @include('includes.footer')\n&lt;\/body&gt;\n&lt;\/html&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;!<\/span><span style=\"color: #79B8FF\">DOCTYPE<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">Home<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Page<\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">title<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">head<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">@include<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'includes.header'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">div<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">class=<\/span><span style=\"color: #9ECBFF\">\"content\"<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><span style=\"color: #79B8FF\">Welcome<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">to<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">the<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">home<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">page<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">of<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">My<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Application<\/span><span style=\"color: #F97583\">!&lt;\/<\/span><span style=\"color: #79B8FF\">p<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">div<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">@include<\/span><span style=\"color: #E1E4E8\">(<\/span><span style=\"color: #9ECBFF\">'includes.footer'<\/span><span style=\"color: #E1E4E8\">)<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">body<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">html<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this home page template, we use <code>@include('includes.header')<\/code> to include the header and <code>@include('includes.footer')<\/code> for the footer. These directives pull in the content from the respective header and footer Blade files.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"components\">Laravel Blade Components<\/h2>\n\n\n\n<p>With the introduction of Blade components in Laravel 7, developers gained a more encapsulated and robust method for building reusable UI elements. These components enhance the modularity of your application\u2019s design, allowing for cleaner and more maintainable code.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"create-component\">Creating and Using a Blade Component<\/h3>\n\n\n\n<p>Let\u2019s create a simple Blade component for a button and demonstrate how to use it in a view.<\/p>\n\n\n\n<p>First, we create a new Blade file for the button component.<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/components\/button.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;button type=&quot;{{ $type }}&quot; class=&quot;btn {{ $class }}&quot;&gt;\n    {{ $slot }}\n&lt;\/button&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">button<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">\"{{ <\/span><span style=\"color: #E1E4E8\">$type<\/span><span style=\"color: #9ECBFF\"> }}\"<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">class=<\/span><span style=\"color: #9ECBFF\">\"btn {{ <\/span><span style=\"color: #E1E4E8\">$class<\/span><span style=\"color: #9ECBFF\"> }}\"<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    {{ $slot }}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">button<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this component, <code>{{ $type }}<\/code> is a variable for the button type (like \u2018submit\u2019, \u2018button\u2019, etc.), <code>{{ $class }}<\/code> allows additional CSS classes to be applied, and <code>{{ $slot }}<\/code> is used for the button\u2019s label or content.<\/p>\n\n\n\n<p>To use the component in a Blade view, you use the <code>&lt;x-<\/code> tag syntax. Here\u2019s how you can use the button component in a form:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono-NL.ttf\" style=\"font-size:1.25rem;font-family:Code-Pro-JetBrains-Mono-NL,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:10px 0px 10px 16px;margin-bottom:-2px;width:100%;text-align:left;background-color:#2f363c;color:#d3d7dd\">views\/form.blade.php<\/span><span role=\"button\" tabindex=\"0\" data-code=\"&lt;form action=&quot;\/submit&quot; method=&quot;post&quot;&gt;\n    &lt;!-- Form fields here --&gt;\n\n    &lt;x-button type=&quot;submit&quot; class=&quot;btn-primary&quot;&gt;\n        Submit\n    &lt;\/x-button&gt;\n&lt;\/form&gt;\" style=\"color:#e1e4e8;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki github-dark\" style=\"background-color: #24292e\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">form<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">action<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">\"\/submit\"<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">method<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">\"post\"<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;!--<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">Form<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">fields<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">here<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">--&gt;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;<\/span><span style=\"color: #79B8FF\">x<\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #79B8FF\">button<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #79B8FF\">type<\/span><span style=\"color: #F97583\">=<\/span><span style=\"color: #9ECBFF\">\"submit\"<\/span><span style=\"color: #E1E4E8\"> <\/span><span style=\"color: #F97583\">class=<\/span><span style=\"color: #9ECBFF\">\"btn-primary\"<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">        <\/span><span style=\"color: #79B8FF\">Submit<\/span><\/span>\n<span class=\"line\"><span style=\"color: #E1E4E8\">    <\/span><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">x<\/span><span style=\"color: #F97583\">-<\/span><span style=\"color: #79B8FF\">button<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #F97583\">&lt;\/<\/span><span style=\"color: #79B8FF\">form<\/span><span style=\"color: #F97583\">&gt;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>In this example, <code>&lt;x-button type=\"submit\" class=\"btn-primary\"&gt;<\/code> creates a submit button with the primary button styling. The text between the tags \u201cSubmit\u201d is passed into the component and rendered where <code>{{ $slot }}<\/code> is in the button component.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"components-benefits\">Benefits of Using Blade Components<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Encapsulation<\/strong>: Components encapsulate both the structure and logic of UI elements, making them more self-contained and easier to manage.<\/li>\n\n\n\n<li><strong>Reusability<\/strong>: Components can be reused across different parts of your application, reducing code duplication.<\/li>\n\n\n\n<li><strong>Customization<\/strong>: Components can accept parameters and content, allowing for flexible customization when reused.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"conclusion\">Conclusion<\/h2>\n\n\n\n<p>Blade is an indispensable part of the Laravel ecosystem, offering a blend of simplicity and power for web interface development. Its intuitive syntax, combined with Laravel\u2019s robust features, makes Blade ideal for developers seeking to build efficient, maintainable, and interactive web applications.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Laravel Blade, the framework\u2019s built-in templating engine, makes it easy to blend PHP with HTML. This seamless integration simplifies building dynamic web interfaces, making Blade a key feature of Laravel. In this comprehensive guide, we&#8217;ll dive into Blade&#8217;s fundamentals, equipping you with the knowledge to craft responsive and interactive web pages easily. Choose from our&nbsp;Laravel<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\"> Read More ><\/a><\/p>\n","protected":false},"author":57032,"featured_media":107977,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4486],"tags":[],"class_list":["post-107863","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-laravel"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Laravel Blade Basics | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn Laravel Blade basics, including directives, layouts, and components, to simplify your Laravel development.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Laravel Blade Basics | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn Laravel Blade basics, including directives, layouts, and components, to simplify your Laravel development.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-21T05:44:17+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-03-17T14:23:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Derrell\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Derrell\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\"},\"author\":{\"name\":\"Derrell\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7\"},\"headline\":\"Laravel Blade Basics\",\"datePublished\":\"2023-11-21T05:44:17+00:00\",\"dateModified\":\"2025-03-17T14:23:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\"},\"wordCount\":1039,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png\",\"articleSection\":[\"Laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\",\"name\":\"Laravel Blade Basics | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png\",\"datePublished\":\"2023-11-21T05:44:17+00:00\",\"dateModified\":\"2025-03-17T14:23:40+00:00\",\"description\":\"Learn Laravel Blade basics, including directives, layouts, and components, to simplify your Laravel development.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png\",\"width\":1200,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Laravel Blade Basics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7\",\"name\":\"Derrell\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/derrell-willis\"],\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/derrellw\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Laravel Blade Basics | InMotion Hosting","description":"Learn Laravel Blade basics, including directives, layouts, and components, to simplify your Laravel development.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/","og_locale":"en_US","og_type":"article","og_title":"Laravel Blade Basics | InMotion Hosting","og_description":"Learn Laravel Blade basics, including directives, layouts, and components, to simplify your Laravel development.","og_url":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2023-11-21T05:44:17+00:00","article_modified_time":"2025-03-17T14:23:40+00:00","og_image":[{"width":1200,"height":630,"url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png","type":"image\/png"}],"author":"Derrell","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Derrell","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/"},"author":{"name":"Derrell","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7"},"headline":"Laravel Blade Basics","datePublished":"2023-11-21T05:44:17+00:00","dateModified":"2025-03-17T14:23:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/"},"wordCount":1039,"commentCount":0,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png","articleSection":["Laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/","url":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/","name":"Laravel Blade Basics | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage"},"thumbnailUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png","datePublished":"2023-11-21T05:44:17+00:00","dateModified":"2025-03-17T14:23:40+00:00","description":"Learn Laravel Blade basics, including directives, layouts, and components, to simplify your Laravel development.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#primaryimage","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png","width":1200,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/laravel-blade-basics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Laravel Blade Basics"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/0736f70b4077032374f89709cdc255b7","name":"Derrell","sameAs":["https:\/\/www.linkedin.com\/in\/derrell-willis"],"url":"https:\/\/www.inmotionhosting.com\/support\/author\/derrellw\/"}]}},"jetpack_featured_media_url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/11\/laravel-blade.png","jetpack_sharing_enabled":true,"primary_category":{"id":4486,"name":"Laravel","slug":"laravel","link":"https:\/\/www.inmotionhosting.com\/support\/edu\/laravel\/"},"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/107863","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/57032"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=107863"}],"version-history":[{"count":17,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/107863\/revisions"}],"predecessor-version":[{"id":131593,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/107863\/revisions\/131593"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media\/107977"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=107863"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=107863"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=107863"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}