marcoplus's avatar

Try importing this class: Spatie\Html\Elements\Form

This package is abandoned and no longer maintained. The author suggests using the spatie/laravel-html package instead.

Error
PHP 8.2.5
10.16.1
Class "Form" not found

A class import is missing
You have a missing class import. Try importing this class: Spatie\Html\Elements\Form.
{!! Form::open(array('route' => 'users.store','method'=>'POST')) !!}

            <div class="row">

                <div class="col-xs-12 col-sm-12 col-md-12">

                    <div class="form-group">

                        <strong>Nome:</strong>

                        {!! Form::text('name', null, array('placeholder' => 'Name','class' => 'form-control')) !!}

                    </div>

                </div>

                <div class="col-xs-12 col-sm-12 col-md-12">

                    <div class="form-group">

                        <strong>Email:</strong>

                        {!! Form::text('email', null, array('placeholder' => 'Email','class' => 'form-control')) !!}

                    </div>

                </div>

I can't find any documentation, what needs to be changed to make it work now?

0 likes
1 reply
marcoplus's avatar
marcoplus
OP
Best Answer
Level 6

Solved you just have to change a few parameters and it works again

{{ Html()->form('PUT')->route('users.store')->open() }}
            <div class="row">
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Nome:</strong>
                        {{ html()->text('name', null, array('placeholder' => 'Name','class' => 'form-control')) }}
                    </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Email:</strong>
                        {{ html()->email('email', null, array('placeholder' => 'Email','class' => 'form-control')) }}
                    </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Password:</strong>
                        {{ html()->password('password', array('placeholder' => 'Password','class' => 'form-control')) }}
                    </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Conferma Password:</strong>
                        {{ html()->password('confirm-password', array('placeholder' => 'Confirm Password','class' => 'form-control')) }}
                    </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12">
                    <div class="form-group">
                        <strong>Ruolo:</strong>
                       {{ html()->select('roles[]', $roles,[], array('class' => 'form-control','multiple')) }}
                    </div>
                </div>
                <div class="col-xs-12 col-sm-12 col-md-12 text-center">
                    <button type="submit" class="btn btn-primary">Salva</button>
                </div>
            </div>
            {{ html()->form()->close() }}
        </div>

I made this change and the page is working again I hope what I did is correct

Please or to participate in this conversation.