-1

I try to use the following package in Laravel 8: https://github.com/kristijanhusak/laravel-form-builder

In the documentation it says the routes should look like this:

Route::get('songs/create', [
    'uses' => 'SongsController@create',
    'as' => 'song.create'
]);

Route::post('songs', [
    'uses' => 'SongsController@store',
    'as' => 'song.store'
]);

Which does not work for Laravel 8, so i changed the code according to the following post:https://stackoverflow.com/a/63808132/2192013

Route::get('songs/create', [
    SongsController::class, 'create'
]);

Route::post('songs', [
    SongsController::class, 'store'
]);

But now when i go to /songs/create i get the following error:

Symfony\Component\Routing\Exception\RouteNotFoundException

Route [song.store] not defined.

How can i make it work in Laravel 8, which should be supported by the package?

danronmoon
  • 3,814
  • 5
  • 34
  • 56

1 Answers1

2

the error you get says that song.store is not defined which is right cause you had given it a name and now you dont according to the given code. Try this instead.

Route::get('songs/create', [
    SongsController::class, 'create'
])->name('song.create');

Route::post('songs', [
    SongsController::class, 'store'
])->name('song.store');

in your form you probably use the named route song.store