Fairly new at Laravel and trying to grasp the store function and routing. I'm getting the following error trying to open a form in Laravel:
Missing required parameters for [Route: {$route->getName()}] [URI: {$route->uri()}].
The issue is because my url is:
/projects/1/documents/create
And I'm opening to:
/projects/1/documents
I'm trying to pass the projects ID but I'm missing something.
Form Call:
{!! Form::open(['route'=>'projects.documents.store', $project->id]) !!}
@include('pages.projects.documents.charter.partials._form', ['submitButtonText'=>'Create Project Charter'])
{!! Form::close() !!}
My Web Route (I'm assuming the issue is here):
// Resource route for Project Document Controller
Route::resource('projects.documents', 'Project\DocumentController');
My DocumentController store function:
public function store(Request $request, Project $project)
{
// Validate the request
}
I'm not sure if there is any other sections of code that are need. The page renders fine without Form::open and $project->id echo's out correctly.
Edit:
I figured out my issue, it was somewhat silly. Just not use to Laravel formatting yet. The route & param needed to be in an array. The correct formatting is:
{!! Form::open(['route'=>array('projects.documents.store', $project->id)]) !!}