I need build forms in Laravel Blade. I am very beginner in Laravel. I use in my project Laravel 7. I found component: https://www.bgaze.fr/bootstrap-formv
It’s ok?
I want build this form in Bootstram 4:
<form method="POST" @if($page ?? false) action="{{ route('page.update', ['id' => $page->id ?? null]) }}" @else action="{{ route('page.store') }}" @endif class="form form-horizontal form-bordered"> @if($page ?? false) @method('PUT') @endif {{ csrf_field() }} <div class="box-body"> <div class="form-group"> <label for="title">Tytuł strony tekstowej*</label> <input id="title" type="text" name="title" required="required" maxlength="155" class="form-control" placeholder="Wpisz tytuł strony tekstowej*" value="{{ $page->title ?? old('title') }}"> </div> <div class="form-group"> <label for="exampleInputEmail1">Treść strony tekstowej</label> <textarea class="form-control summernote" name="content" rows="3" placeholder="Wpisz treść strony tekstowej">{{ $page->content ?? old('content') }}</textarea> </div> <div class="form-group size-200"> <label for="exampleInputEmail1">Wpis aktywny</label> <label class="switch "> <input name="enable" value="1" @if(!empty($page) && $page->enable == '1') checked="checked" @endif type="checkbox" class="primary" id="switch1"/> <span class="switcher round"></span> </label> </div> <div class="box-footer"> <button type="submit" class="btn btn-primary">Save </button> </div> </div> </form>
How can I make this form in https://www.bgaze.fr/bootstrap-form ? Could I have some example of this form, please? I would like to build my remaining forms based on this example
Please help me 🙂
Advertisement
Answer
You can use laravelcollective/html instead of bgaze/bootstrap-form
Example:
{!! Form::open(array('route'=>array('users.create'), 'method'=>'post')) !!} <div class="form-group"> {!! Form::label('name', 'Name:',['class'=>'control-label']) !!} {!! Form::text('name', '', array('id' => 'name','class'=>'form-control')) !!} </div> <button type="submit" class="btn btn-block btn-success">Save</button> {!! Form::close() !!}