R
R
Roman2020-02-14 17:45:12
Laravel
Roman, 2020-02-14 17:45:12

How to make it easy to change styles in a Laravel form using the Blade templating engine?

I am creating a form in Laravel 6. There are a lot of different fields in the form. They are all the same, see below for an example. I asked myself that if I want to change the style of the form, I will have to change the Bootstrap classes in all fields. And almost the same change everywhere. And since there are a lot of fields, it seems like a stupid and routine task. Is it possible to solve this problem using the Blade template engine?

{!! Form::open() !!}
    <div class="form-group row">
        {!! Form::label('name', 'Имя', ['class' => 'col-sm-1 col-form-label']) !!}
        <div class="col-sm-10">
            {!! Form::text('phone', $userName, ['class' => 'form-control col-sm-2', 'readonly']) !!}
        </div>
    </div>
    ...
{!! Form::close() !!}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Anton, 2020-02-14
@gagablik

https://laravelcollective.com/docs/6.0/html#custom...

V
Vladimir Kokhan, 2020-02-14
@SkazochNick

The solution is obvious - put the form in a file and include @include

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question