Reputation: 576
my route:
$this->post('imagerequests/{id}/save-building', 'ImageRequestController@saveBuildingImage')->name('saveBuildingImage');
my opening form:
{{ Form::open(array('route' => ['saveBuildingImage' => $imageRequest->id])) }}
When I dd($imageRequest)
I see the id in the attributes so no problem there.
error message:
Undefined offset: 0 in FormBuilder.php line 1160
Upvotes: 0
Views: 659
Reputation: 576
Found the issue to fix it using Laravel Collective
{{ Form::open(array('route' => array('saveBuildingImage', $imageRequest->id))) }}
Upvotes: 0
Reputation: 758
Laravel's route expects the $id
variable. But in the view, you didn't send variable name. Without using Laravel collective package notation you should use in this form to pass data:
route('saveBuildingImage', ['id' => $imageRequest->id]);
Upvotes: 1