<?php

Form::macro('loginForm', function ($name, $url, $title = null, $btnSubmit = 'Login', $errors = null) {
    $openForm = Form::open(['name' => $name, 'id' => $name, 'url' => $url, 'class' => 'form-vertical']);
    $closeForm = Form::close();
    $submit = Form::submit($btnSubmit, ['class' => 'btn btn-info form-control']);
    $css = asset('/css/form.css');
    $username = Form::loginUsername('name', 'User ID', $errors);
    $password = Form::loginPassword('password', 'Password', $errors);
    $item = <<<HTML
\t<link href="{$css}" rel="stylesheet" type="text/css" />

    {$openForm}
\t<fieldset class="panel panel-primary">
\t\t<legend class="panel-heading">{$title}</legend>
\t\t<div class="panel-body">
\t\t\t{$username}
\t\t\t{$password}
    \t\t<div class="form-group">
    \t\t\t<div class="col-md-4"></div>
    \t\t\t<div class="col-md-8">{$submit}</div>
    \t\t</div>
\t\t</div>
\t</fieldset>
    {$closeForm}
HTML;
    return $item;
});
Form::macro('loginUsername', function ($name, $title, $errors = null) {
    $label = Form::label($name, $title, ['class' => 'control-label required col-md-12']);
    $input = Form::text($name, old($name), ['placeholder' => $title, 'class' => 'form-control', 'required']);