asset url
Using Asset directive you can display absolute path of the file stored in the /public directory.
{{ asset('images/site-logo.png') }}
copy
Using Asset directive you can display absolute path of the file stored in the /public directory.
{{ asset('images/site-logo.png') }}
copy
Blade helper providing support for the CSRF token.
@csrf
// This returns
<input type="hidden" name="_token" value="[CSRF_HASH_TOKEN]">
copy
Extend another layout. Use '.' or '/' notation to separate directories.
@extends('default')
copy
Foreach loop example.
@foreach($items as $item)
<li>{{ $item }}</li>
@endforeach
copy
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 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 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
Ternary operator for 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.
@yield('content', 'Sorry, no content yet')
copy