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')); }
public function jsonSerialize() { $result = parent::jsonSerialize(); $result['imageUrl'] = $this->getModel()->imageUrl; $aux = explode(DIRECTORY_SEPARATOR, $result['imageUrl']); $result['baseName'] = array_pop($aux); return $result; }
/** * 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')]); }