netojose / laravel-bootstrap-4-forms

Bootstrap 4 forms for Laravel 5/6/7/8
MIT License
183 stars 58 forks source link

"dot" syntax in names #51

Open mkswebdev opened 5 years ago

mkswebdev commented 5 years ago

netojose/laravel-bootstrap-4-forms 2.0.6

I use dimsav/laravel-translatable.

Form fields:

{!! Form::text('ru[title]', 'Title RU', $presentation->translateOrNew('ru')->title) !!}
{!! Form::text('en[title]', 'Title EN', $presentation->translateOrNew('en')->title) !!}
...

Validation rules:

    public function rules()
    {
        return [
            'ru.title'      => 'required|string|max:255',
            'en.title'      => 'string|max:255',
            ...
        ];
    }

If errors occur, data is returned to form with rules names, "dot" syntax is used. ru.title != ru[title] and field ru[title] reset value and does not show an error.

Is there any solution for this problem?

netojose commented 5 years ago

Good question, @mkswebdev , I'm working on a new version, and your problem sounds interesting, on work with "array fields". I will think about this