0

laravelcollective/html is abandoned. I'm looking for reliable replacement. Many say spatie/laravel-html is good alternative. But I faced with problem of lack of documentation.

Example from laravelcollective/html usage:

{!! Form::model($user, ['route' => ['users.update', $user->id], 'method' => 'patch', 'id' => 'edit-user']) !!}
 @include('users.fields')
{!! Form::close() !!}

How to made form using route with spatie/laravel-html? (Of course, I can pass url for form action from controller, but it seems less elegant solution than laravelcollective had) Is there some good documentation for spatie/laravel-html and of course, is spatie/laravel-html really good alternative for abandoned laravelcollective/html? Following spatie/laravel-html alternative not accept route as action param:

 {{ html()->modelForm($user, 'PUT', 'some/url')->open() }}
  {{ html()->text('name') }}
 {{ html()->closeModelForm() }}

Thanks in advance!

A.T.
  • 81
  • 9
  • Lack of [documentation](https://spatie.be/docs/laravel-permission/v5/introduction) ? ... what documentation are you seeking that Spatie's own information does not cover? – Paul T. Aug 24 '23 at 01:30
  • I need documentation that covers every spatie/laravel-html abilities.Like php documentation, Please look question example I put in the question.. – A.T. Aug 24 '23 at 01:44
  • https://spatie.be/docs/laravel-html/v3/general-usage/html-builder – A.T. Aug 24 '23 at 01:45
  • It seems no one switched from laravelcollective/html (abandoned by authors - deprecated) to spatie/laravel-html, yet. – A.T. Aug 24 '23 at 08:12
  • Not my downvote, but some are overzealous apparently. Anyway, understood about an answer, and others may have the same problem (though how many are affected is an unknown, and some may have found other alternatives), but unfortunately, answers are not always immediate. It could possibly take weeks or months, or it can happen that a question may never be answered. The situation here is pretty unique, and someone having done what you're trying to do may be hard to find. Nothing against you, but that is pretty much how all Q&A forums generally operate. – Paul T. Aug 25 '23 at 13:49
  • Solution is: {{ html()->modelForm($user, 'PUT', route('users.update', [$user->id]))->open() }} {{ html()->text('name') }} {{ html()->closeModelForm() }} it works for me. – A.T. Aug 25 '23 at 15:46

1 Answers1

1

Use laravel's helper route(). Depending on route it can looks like following:

{{ html()->modelForm($user, 'PUT', route('users.update', [$user->id]))->open() }} 
    {{ html()->text('name') }} 
{{ html()->closeModelForm() }}
A.T.
  • 81
  • 9