I am getting a 404 status code on a laravel resource route when posting a model bound form. The form opening tag is as follows:
{!!Form::model($project, ['route' => ['admin.projects.update', $project->id], 'method' => 'PUT', 'files' => true])!!}
//Form content here
{!! Form::close() !!}
And the resource route as it appears under routes:list is:
+--------+----------+-----------------------------------+-------------------------+------------------------------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+-----------------------------------+-------------------------+------------------------------------------------------------------+------------+
| | PUT | admin/projects/{projects} | admin.projects.update | App\Http\Controllers\Admin\AdminProjectsController@update | |
and the controller:
public function update(CreateProjectRequest $request, $id)
{
$data = $request->all();
$project = Project::findOrFail($id);
$project->update($data);
return redirect('admin/projects/edit/all');
}
When I check the response in devtools, the payload is attached and the route url is correct. For example, if I am updating a project with an id of 150, the url is
http://localhost:8888/project-name/public/admin/projects/150
If I don't make any changes, the redirect from the controller works. If I only add files through the form it also works. It's when I change the text input data that I have the issue. I've never had this issue using resourceful routing before and can't for the life of me solve the issue after a couple of hours of trying.
Any fresh eyes see where I am making a mistake?