Ejemplo n.º 1
0
 public function testEmailInput()
 {
     $form = new Form();
     $form->email = new CharField(['label' => 'My Email']);
     $element = $this->toDomElement($form->email->email());
     $this->assertEquals('input', $element->tagName);
     $this->assertEquals('Form-email', $element->getAttribute('name'));
     $this->assertEquals('email', $element->getAttribute('type'));
     $this->assertEquals('', $element->getAttribute('value'));
     $form->setData(['Form-email' => 'Jack']);
     $element = $this->toDomElement($form->email->text());
     $this->assertEquals('Jack', $element->getAttribute('value'));
 }
Ejemplo n.º 2
0
 public function jsonSerialize()
 {
     $result = parent::jsonSerialize();
     $result['imageUrl'] = $this->getModel()->imageUrl;
     $aux = explode(DIRECTORY_SEPARATOR, $result['imageUrl']);
     $result['baseName'] = array_pop($aux);
     return $result;
 }
Ejemplo n.º 3
0
 /**
  * Update the specified product in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $forms = $this->getForms(Input::all(), $id);
     if (!$this->validateForms($forms)) {
         return Redirect::back()->withErrors(\ModelForm\Form::mergeErrors($forms))->withInput();
     }
     $this->saveForms($forms);
     return Redirect::route("admin.product.index", ['category' => Input::get('category')]);
 }