I created a custom controller action to save the "second level" of my configuration objects, since the initial form saves credentials that are then used to pull available items from a web service.
The second level configuration method is
ConfigurationController
public function storeTest(Request $request)
{
dd($request);
}
The route was added to the web.php routes file:
web.php
// configuration routes
Route::resource('configurations', 'ConfigurationController');
Route::put('configurations/test/{$id}', 'ConfigurationController@storeTest')->name('configurations.test_update');
The output from php artisan route:list shows the route correctly:
| PUT | configurations/test/{$id} | configurations.test_update | App\Http\Controllers\ConfigurationController@storeTest | web
And finally my form, using the LaravelCollective form package:
{!! Form::model($configuration, ['action' => ['ConfigurationController@storeTest', $configuration->id], 'method' => 'put']) !!}
Viewing source on the form page shows that the action looks right:
<form method="POST" action="http://ift.tt/2ebTu8l" accept-charset="UTF-8"><input name="_method" type="hidden" value="PUT">
But when the form gets submitted, it throws an error saying that NotFoundHttpException in RouteCollection.php line 161
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire