Ejemplo n.º 1
0
 public function make($form)
 {
     $html = new Html();
     $uniqueID = uniqueID('form');
     $html->tag('form')->id($uniqueID);
     isset($form['method']) && $form['method'] ? $html->method($form['method']) : false;
     isset($form['name']) && $form['name'] ? $html->name($form['name']) : false;
     isset($form['action']) && $form['action'] ? $html->action($form['action']) : false;
     isset($form['enctype']) && $form['enctype'] ? $html->enctype($form['enctype']) : false;
     isset($form['class']) && $form['class'] ? $html->class($form['class']) : false;
     $html->tag('input')->type('hidden')->name('_token')->value(csrf_token())->tag();
     if (isset($form['fields']) && !empty($form['fields'])) {
         $html->append($this->body($form['fields']));
     }
     $html->tag('button')->id('submit-' . $uniqueID)->type('submit')->class('btn btn-primary')->text('Add')->tag();
     $html->tag();
     return $html->give();
 }