Blade
is a simple, yet powerful templating engine provided with [Laravel] (http://laravel.com) PHP framework.
These snippets works with blade files (.blade.php
) either with php syntax or with blade syntax using: PHP - Laravel Blade available from [Laravel Blade Highlighter] (https://github.com/Medalink/laravel-blade) package.
##Usage
When you're on a blade file, type the snippet shortcut then press tab
key.
##Installation
Via Package Manager
search for Blade Snippets
then click/tap…wait a sec and tadam!
Or clone this repository into your Packages folder:
git clone https://github.com/dev4dev/blade-snippets.git
Or download the snippets zip file and unzip it into your Packages folder.
##Avalable snippets
Shortcut | Result |
---|---|
can | @can('policy ', $model) {{-- expr --}} @endcan |
cane | @can('policy ', $model) {{-- expr --}} @else {{-- expr --}} @endcan |
ext | @extends('name ') |
lay | @layout('name ') |
sec | @section('name ') {{-- expr --}} @endsection |
secy | @section('name ') {{-- expr --}} @yield_section |
hass | @hasSection('name ') {{-- expr --}} @else {{-- expr --}} @endif |
yl | @yield('section ', 'default ') |
lsec | @section('name ') {{-- expr --}} @show |
par | @parent |
stack | @stack('name ') |
push | @push('name ') {{-- expr --}} @endpush |
!! | {!! $var !!} |
}} | {{ escaped output }} |
inc | @include('view.name ', ['some' => 'data'] ) |
if | @if (condition ) {{-- expr --}} @endif |
ife | @if (condition ) {{-- expr --}} @else {{-- expr --}} @endif |
foreach | @foreach($array as $element ) {{-- expr --}} @endforeach |
fore | @forelse ($array as $element ) {{-- expr --}} @endforelse |
for | @for ($i = 0 ; $i < … ; $i++ ) {{-- expr --}} @endfor |
each | @each ('item.view ', $items , 'item ', 'empty.view ') |
trans | {{ trans('language.line ') }} |
route | {{ route('name ') }} |
asset | {{ asset('path ') }} |
url | {{ url('path ') }} |
while | @while (condition ) {{-- expr --}} @endwhile |
unless | @unless (condition ) {{-- expr --}} @endunless |
choise | @choice('language.line ', $number ) |
comment | {{-- comment --}} |
lang | @lang('language.line ', array('variable => 'replacement ')) |
inject | @inject('name ', 'App\Services\ServiceName ') |
Original snippets by: @dev4dev
Cool Readme formatting and latest updates belong to:
- Github: @AAlakkad.
- Twitter: @Am_Alakkad.
- Email: [email protected].