Skip to content

Commit

Permalink
Bump version 3 to master
Browse files Browse the repository at this point in the history
  • Loading branch information
netojose committed Jun 21, 2019
2 parents f7c842e + d1bdf1e commit 61628ff
Show file tree
Hide file tree
Showing 4 changed files with 588 additions and 1,172 deletions.
153 changes: 147 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for

```php
// Making all inputs inline
{!!Form::inlineForm()!!}
{!!Form::open()->formInline()!!}

// You can use FALSE to turn off disable form inline
{!!Form::open()->formInline(false)!!}
```

#### Fieldset
Expand Down Expand Up @@ -161,7 +164,7 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
| \$name | string | null | Input name |
| \$label | string | null | Input label |
| \$value | string | null | Input value |
| \$default | boolean | null | Default value |
| \$checked | boolean | null | Default value |

```php
// Example
Expand All @@ -175,7 +178,7 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
| \$name | string | null | Input name |
| \$label | string | null | Input label |
| \$value | string | null | Input value |
| \$default | boolean | null | Default value |
| \$checked | boolean | null | Default value |

```php
// Example
Expand Down Expand Up @@ -207,6 +210,19 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
{!!Form::date('birthday', 'Birthday')!!}
```

#### Tel inputs

| Param | Type | Default | Description |
| --------- | ------ | ------- | ------------- |
| \$name | string | null | Input name |
| \$label | string | null | Input label |
| \$default | string | null | Default value |

```php
// Example
{!!Form::tel('number', 'Phone number')!!}
```

#### Time inputs

| Param | Type | Default | Description |
Expand All @@ -220,6 +236,19 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
{!!Form::time('hour', 'Meeting hour')!!}
```

#### Time inputs

| Param | Type | Default | Description |
| --------- | ------ | ------- | ------------- |
| \$name | string | null | Input name |
| \$label | string | null | Input label |
| \$default | string | null | Default value |

```php
// Example
{!!Form::urlInput('website', 'You website')!!}
```

#### Range inputs

| Param | Type | Default | Description |
Expand Down Expand Up @@ -292,9 +321,9 @@ If you is using Laravel 5.5, the auto discovery feature will make everything for
### Filling a form

| Param | Type | Default | Description |
| ------ | ------ | ------- | ----------- |
| \$data | object | array | null | DAta fo fill form inputs |
| Param | Type | Default | Description |
| ------ | ------------ | ------- | ------------------------ |
| \$data | object/array | array | Data fo fill form inputs |

```php
// Examples
Expand Down Expand Up @@ -334,6 +363,89 @@ Use in anchors and forms openings
{!!Form::anchor("Link via route")->route('home')!!}
```

### Error Bag

Use if you have more then one form per page. You set an identifier for each form, and the errors will be attached for that specific form

| Param | Type | Default | Description |
| ------- | ------ | ------- | -------------- |
| \$value | string | null | Error bag name |

```php
// Example: attach this form to a error bag called "registerErrorBag"
{!!Form::open()->route('register.post')->errorBag("registerErrorBag")!!}

// ------------------------------------------------------

// Now, in your controller (register.post route), you can redirect the user to a form page again, with erros inside a error bag called "registerErrorBag"
public function register(Request $request)
{
$validator = Validator::make($request->all(), [
// ... rules here
]);

if ($validator->fails()) {
return redirect()
->route('register.form')
->withInput()
->withErrors($validator, 'registerErrorBag');
}

// Proced to register here
}

// ------------------------------------------------------

// If your validation is on a Form Request, you can add a protected method "$errorBag" to set a ErrorBag name

class RegisterRequest extends FormRequest
{

protected $errorBag = 'registerErrorBag';

public function authorize()
{
return true;
}

public function rules()
{
return [
// ... rules here
];
}
}
```

### Errors

Show all errors inside a panel

| Param | Type | Default | Description |
| ------- | ------ | ------- | ----------- |
| \$title | string | null | Panel title |

```php
// Example
{!!Form::errors("The form has errors")!!}
```

### Disable validation messages

Disable success/error status and validation error message

| Param | Type | Default | Description |
| ---------- | ------- | ------- | --------------- |
| \$disabled | boolean | false | Disabled status |

```php
// Example
{!!Form::text('username', 'User name')->disableValidation()!!}

// You can use FALSE to turn off disable validation (to enable it)
{!!Form::text('username', 'User name')->disableValidation(false)!!}
```

### Checked

Set the checkbox/radio checked status
Expand Down Expand Up @@ -361,6 +473,9 @@ Set the checkbox/radio checked status
{!!Form::radio('orange', 'Orange')->inline()!!}

{!!Form::checkbox('orange', 'Orange')->inline()!!}

// You can use FALSE to turn off inline status
{!!Form::checkbox('orange', 'Orange')->inline(false)!!}
```

### Placeholder
Expand Down Expand Up @@ -651,6 +766,32 @@ complete list is in the spec mentioned above.
{!!Form::text('email', 'Your email')->type('email')!!}
```

### Min

| Param | Type | Default | Description |
| ------- | ------ | ------- | ------------- |
| \$value | number | null | Minimum value |

Set min attribute for input

```php
// Example
{!!Form::text('age', 'Your age')->type('number')->min(18)!!}
```

### Max

| Param | Type | Default | Description |
| ------- | ------ | ------- | ------------- |
| \$value | number | null | Minimum value |

Set max attribute for input

```php
// Example
{!!Form::text('age', 'Your age')->type('number')->max(18)!!}
```

### Name

| Param | Type | Default | Description |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"email": "sputinykster@gmail.com"
}
],
"version": "2.0.6",
"version": "3.0.0",
"minimum-stability": "dev",
"require": {},
"autoload": {
Expand Down
Loading

0 comments on commit 61628ff

Please sign in to comment.