grohiro / laravel-blade-macro
Laravel Blade `@macro` directive.
Installs: 8 306
Dependents: 0
Suggesters: 0
Security: 0
Stars: 14
Watchers: 4
Forks: 3
Open Issues: 1
Type:helper
This package is auto-updated.
Last update: 2024-10-29 04:36:23 UTC
README
- Available for Laravel 5.3+
- (not working) (2017/10/3)
LaravelBladeMacro creates a reusable template block in a blade template file.
Usage
form.blade.php
@macro('bootstrap_input', $type, $field, $label = "", $opts = ['class' => 'form-control'])
<div class="form-group">
<label class="col-sm-1 control-label">{{$label}}</label>
<div class="col-sm-8">
{!! Form::$type($field, '', $opts) !!}
</div>
</div>
@endmacro
{!! Html::bootstrap_input('text', 'username', 'Username') !!}
{!! Html::bootstrap_input('text', 'email', 'E-Mail', ['required' => 'required', 'class' => 'form-control']) !!}
Requirements
- Laravel Collective/HTML for
Html
Facade.
Install
$ composer require 'grohiro/laravel-blade-macro'
config/app.php
$providers = [ // Grohiro\LaravelBladeMacro\BladeMacroServiceProvider::class, ];