So I have this dropdown select for floor levels in my create form its working fine but the edit form I want to set the dropdown selection to the floor that's been selected in the create form instead of having an empty drop-down select so what I did is this
<div class="form-group">
{!! Form::label('Office Floor') !!}
{{Form::select('floor', $office->floor,
[ ''=>'',
'Basement' => 'Basement',
'1st Floor' => '1st Floor',
'2nd Floor' => '2nd Floor',
'3rd Floor' => '3rd Floor',
'4th Floor' => '4th Floor',
], null,['class' => 'form-control'])}}
I used to have input fields before and "$office->floor" is working but when I try that it has this error
Type error: Argument 4 passed to Collective\Html\FormBuilder::select() must be of the type array, null given, called in C:\xampp\htdocs\Eguide\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 221 (View: C:\xampp\htdocs\Eguideesources\views\editoffice.blade.php)
createoffice.blade.php
{!! Form::open(array('route' => ['createoffice', $id], 'class' => 'form')) !!}
<div class="container">
<div class="form-group">
{!! Form::label('Office Name') !!}
{!! Form::text('officename', null, array('required',
'class'=>'form-control',
'placeholder'=>'Office Name')) !!}
</div>
<div class="form-group">
{!! Form::label('Office Floor') !!}
{{Form::select('floor',
[ ''=>'',
'Basement' => 'Basement',
'1st Floor' => '1st Floor',
'2nd Floor' => '2nd Floor',
'3rd Floor' => '3rd Floor',
'4th Floor' => '4th Floor',
], null,['class' => 'form-control'])}}
<!--{!! Form::text('floor', null, array('required',
'class'=>'form-control',
'placeholder'=>'Office Floor')) !!} -->
</div>
<div class="form-group">
{!! Form::submit('Create Office',
array('class'=>'btn btn-primary')) !!}
<a href="{{ url('building/' . $id) }}" class="btn btn-info">
<span class="glyphicon glyphicon-arrow-left"></span> Back
</a>
</div>
{!! Form::close() !!}
@endsection