Using Asset directive you can display absolute path of the file stored in the /public directory.

#blade
{{ asset('images/site-logo.png') }}
copy

Blade helper providing support for the CSRF token.

#blade
@csrf

// This returns
<input type="hidden" name="_token" value="[CSRF_HASH_TOKEN]">
copy

Extend another layout. Use '.' or '/' notation to separate directories.

#blade#layout
@extends('default')
copy

Foreach loop example.

#blade#loop
@foreach($items as $item)
    <li>{{ $item }}</li>
@endforeach
copy

Simple example of extending layouts and using sections.

#blade#layout
// home.blade.php

@extends('default')

@section('content')
    <main>Welcome to my homepage.</main>
@endsection


// default.blade.php extended by home.blade.php

<!DOCTYPE html>
<head>
    <title>Page title</title>
</head>
<body>
    @yield('content')
</body>
</html>
copy

Blade helper providing support for the missing form requests like PATCH and DELETE.

#blade
@method('DELETE')

// This returns
<input type="hidden" name="_method" value="DELETE">
copy

Blade uses the {{ }} syntax in most cases but you can use {!! !!} to stop Blade from escaping the data.

#blade
{{ $data }} // escapes the data by default
{!! $data !!} // no escaping 
copy

Ternary operator for Blade.

#blade
{{ (Auth::user()->check()) ? 'You are logged in' : 'Please log in' }}
copy

Inserts content specified in a template section. Use the second attribute to pass a default value.

#blade#layout
@yield('content', 'Sorry, no content yet')
copy
NordVPN NordVPN