Commit b482c733 authored by Sylvain CARRE's avatar Sylvain CARRE 🖥

Update README.md

parent 3332011a
......@@ -17,6 +17,119 @@ composer require goldenscarab/modulus-service-field
Laravel 5.8 uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.
## Usage simple
#### Input
```php
{!! Field::input([
'label' => 'Champs text',
'name' => 'my_field_name'
]) !!}
```
#### Select
```php
{!! Field::select([
'label' => 'Menu déroulant',
'name' => 'my_field_name',
'options' => [
1 => 'Item 1',
2 => 'Item 2'
]
]) !!}
```
#### Textarea
```php
{!! Field::textarea([
'label' => 'Zone de texte',
'name' => 'my-field'
]) !!}
```
#### Image
```php
{!! Field::image([
'label' => 'Champs image',
'name' => 'my_field_image',
]) !!}
```
Has identique field with `pdf`, `video`, `file`
## Usage advanced
#### Input
```php
{!! Field::input([
'label' => 'Moneyt',
'name' => 'money',
'value' => $item->money,
'size' => 'sm',
'placeholder' => 'ex : 1 200,00',
'is_required' => true,
'prefix' => '<i class="fa fa-money"></i>',
'suffix' => '€',
]) !!}
```
#### Select
```php
// Exemple 1
{!! Field::select([
'label' => 'Menu déroulant',
'name' => 'my_field_name',
'value' => $item->my_field_name,
'placeholder' => 'Choisir ...',
'size' => 'sm',
'is_required' => true,
'options' => [
'collect' => $collection,
'value' => 'id',
'text' => ['code', 'libelle'],
'callback' => 'strtoupper',
'template' => 'Code : %s Libellé : %s',
'datas' => ['attr' => 'id']
]
]) !!}
// Exemple 2 with groups
{!! Field::select([
'label' => 'Menu déroulant',
'name' => 'my_field_name',
'value' => $item->my_field_name,
'placeholder' => 'Choisir ...',
'size' => 'sm',
'is_required' => true,
'options' => [
'Groupe 1' => [
23 => 'Élement 23',
24 => 'Élement 24',
25 => 'Élement 25',
],
'Groupe 2' => [
26 => 'Élement 26',
27 => 'Élement 27',
28 => 'Élement 28',
]
]
]) !!}
```
#### Image
```php
{!! Field::image([
'label' => 'Champs image',
'name' => 'my_field_image',
'value' => $item->my_field_image,
'placeholder' => 'ex: /upload/folder/image.png',
'suffix' => '<i class="fa fa-file-image-o mr-2"></i> Choisir une image',
'is_required' => true,
]) !!}
```
Click [here](example.md) for more examples
## Security
If you discover any security related issues, please email contact@goldenscarab.fr instead of using the issue tracker.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment