0

i have a weird case where when i change the form::open to form::model and add $user, the page layouts are gone. by this i mean if i use below it works fine and all the layouts are perfectly there.

{!! Form::open( ['method'=>'PATCH', 'action'=>['AdminUsersController@update', $user->id], 'files'=>true , 'class'=>'form-horizontal']) !!}

but when i try to get the user details on the edit page with below code, all my layouts and styles on the edit page disappears.

{!! Form::model($user, ['method'=>'PATCH', 'action'=>['AdminUsersController@update', $user->id], 'files'=>true , 'class'=>'form-horizontal']) !!}

chrome doesnt detect any error of not able to get css files. its like laravel drops drops all of it. Below is my full code in edit page.

{!! Form::model($user, ['method'=>'PATCH', 'action'=>['AdminUsersController@update', $user->id], 'files'=>true , 'class'=>'form-horizontal']) !!}
                            <div class="form-group">
                                {!! Form::Label('name', 'Name:', ['class'=>'col-sm-3 control-label']) !!}
                                <div class="col-sm-9">
                                    {!! Form::text('name', null, ['class'=>'form-control','placeholder'=>'Full Name']) !!}
                                </div>
                            </div>
                            <div class="form-group">
                                {!! Form::Label('email', 'Email:', ['class'=>'col-sm-3 control-label']) !!}
                                <div class="col-sm-9">
                                    {!! Form::email('email', null, ['class'=>'form-control','placeholder'=>'user@email.com']) !!}
                                </div>
                            </div>
                            <div class="form-group">
                                {!! Form::Label('password', 'Password:', ['class'=>'col-sm-3 control-label', 'for'=>'password']) !!}
                                <div class="col-sm-9 strength-container">
                                    {!! Form::password('password',  ['class'=>'password-strength-example1 form-control', 'id'=>'password', 'data-plugin'=>'strength']) !!}
                                </div>
                            </div>
                            <div class="form-group">
                                {!! Form::Label('is_active', 'Active:', ['class'=>'col-sm-3 control-label']) !!}
                                <div class="col-sm-9">
                                    {!! Form::hidden('is_active', 0) !!}
                                    {!! Form::checkbox('is_active', 1, null, ['data-plugin'=>'switchery']) !!}
                                </div>
                            </div>
                            <div class="form-group">
                                {!! Form::Label('role_id', 'Role:', ['class'=>'col-sm-3 control-label']) !!}
                                <div class="col-sm-9">
                                    {!! Form::select('role_id', $roles ,null, ['class'=>'form-control']) !!}
                                </div>
                            </div>

                            <div class="form-group form-material">
                                {!! Form::Label('photo_id', 'Photo:', ['class'=>'col-sm-3 control-label', 'for'=>'photo_id']) !!}
                                <div class="col-sm-9">
                                    {!! Form::text('', null, ['class'=>'form-control', 'placeholder'=>'Browse..', 'readonly'=>'']) !!}
                                    {!! Form::file('photo_id', null, ['multiple'=>'']) !!}
                                </div>
                            </div>



                            <div class="form-group">
                                <div class="col-sm-9 col-sm-offset-3">
                                    {!! Form::submit('Submit', ['class'=>'btn btn-primary']) !!}
                                    {!! Form::reset('Reset', ['class'=>'btn btn-danger']) !!}
                                </div>
                            </div>
                            {!! Form::close() !!}

and for reference. both images to see differenceenter image description here

Mohamed Athif
  • 468
  • 2
  • 6
  • 19

1 Answers1

1

Try

{!! Form::file('photo_id', ['multiple'=>'']) !!}

for file field since.

Mahfuzul Alam
  • 3,057
  • 14
  • 15
  • really close. your answer helped me identify the near source. it was the line above your line. i edited it to. {!! Form::text('photo_id', null, ['class'=>'form-control', 'placeholder'=>'Browse..', 'readonly'=>'']) !!} where photo_id was previously empty. thank you. – Mohamed Athif Oct 16 '16 at 11:17