Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Laravel Blade Templating

25

Flashcards

0/25

Still learning
StarStarStarStar

@if ... @endif

StarStarStarStar

Conditional statement. Sample usage: @if (condition)<p>True</p>@endifcondition) <p>True</p> @endif

StarStarStarStar

@empty ... @endempty

StarStarStarStar

Check if a variable is empty. Sample usage: @empty(collection)<p>Noitems.</p>@endemptycollection) <p>No items.</p> @endempty

StarStarStarStar

@foreach ... @endforeach

StarStarStarStar

Loop over each item in an array or collection. Sample usage: @foreach (itemsasitems as item) <p>{{ item }}</p> @endforeach

StarStarStarStar

{{ }}

StarStarStarStar

Echo content with escaped HTML special characters. Sample usage: {{ price }}

StarStarStarStar

@for ... @endfor

StarStarStarStar

C-style for loop. Sample usage: @for (i=0;i = 0; i < 10; i++) <p>{{ i }}</p> @endfor

StarStarStarStar

@include('file_name')

StarStarStarStar

Includes a Blade view from another file. Sample usage: @include('partials.footer')

StarStarStarStar

@csrf

StarStarStarStar

Generates an HTML hidden input field containing a CSRF token. Sample usage: <form>@csrf</form>

StarStarStarStar

@isset ... @endisset

StarStarStarStar

Check if a variable is set. Sample usage: @isset(value)<p>Itisset.</p>@endissetvalue) <p>It is set.</p> @endisset

StarStarStarStar

{!! !!}

StarStarStarStar

Echo content with unescaped data. Be careful of XSS attacks. Sample usage: {!! htmlContent !!}

StarStarStarStar

@unless ... @endunless

StarStarStarStar

Inverse conditional statement. Sample usage: @unless (condition)<p>False</p>@endunlesscondition) <p>False</p> @endunless

StarStarStarStar

@component('component_name') @endcomponent

StarStarStarStar

Renders a Blade component. Sample usage: @component('alert') ... @endcomponent

StarStarStarStar

@php ... @endphp

StarStarStarStar

Execute a block of plain PHP within a template. Sample usage: @php count=0;@endphpcount = 0; @endphp

StarStarStarStar

@json

StarStarStarStar

Encode a PHP array to JSON. Sample Usage: @json(array)array)

StarStarStarStar

@switch ... @endswitch

StarStarStarStar

Switch statement. Sample usage: @switch(variable)@case(1)...@break@default...@endswitchvariable) @case(1) ... @break @default ... @endswitch

StarStarStarStar

@yield('section')

StarStarStarStar

Output the content of a section. Sample usage: @yield('content')

StarStarStarStar

@inject('service', 'App\Services\ServiceName')

StarStarStarStar

Injects a service into a Blade template. Sample usage: @inject('metrics', 'App\Services\MetricsService')

StarStarStarStar

@slot('name') ... @endslot

StarStarStarStar

Fill a slot in a Blade component. Sample usage: @slot('title') My Title @endslot

StarStarStarStar

@push('stack') ... @endpush

StarStarStarStar

Append to a stack of content. Sample usage: @push('scripts') <script>alert('Hello')</script> @endpush

StarStarStarStar

@guest ... @endguest

StarStarStarStar

Content for unauthenticated users. Sample usage: @guest <p>Please log in.</p> @endguest

StarStarStarStar

@error('field') ... @enderror

StarStarStarStar

Show an error message for a form field. Sample usage: @error('email') <div>{{ message }}</div> @enderror

StarStarStarStar

@stack('name')

StarStarStarStar

Renders the entire stack of pushed content. Sample usage: @stack('scripts')

StarStarStarStar

@can('permission') ... @endcan

StarStarStarStar

Check if the user has a certain permission using Laravel's authorization system. Sample usage: @can('edit-posts') <button>Edit</button> @endcan

StarStarStarStar

@section('name') ... @endsection

StarStarStarStar

Define a section of content. Sample usage: @section('sidebar') ... @endsection

StarStarStarStar

@verbatim ... @endverbatim

StarStarStarStar

Escape Blade rendering within a block, allowing plain HTML. Sample usage: @verbatim <div>{{ This will not be processed by Blade }}</div> @endverbatim

StarStarStarStar

@auth ... @endauth

StarStarStarStar

Content for authenticated users. Sample usage: @auth <p>Welcome back!</p> @endauth

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.