#blade

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

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

Blade helper providing support for the CSRF token.

@csrf

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

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

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

Foreach loop example.

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

Simple example of extending layouts and using sections.

// 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

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

@method('DELETE')

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

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

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

Ternary operator for Blade.

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

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

@yield('content', 'Sorry, no content yet')
copy
Sitemap Git repository