Reputation: 363
Current code
<form action="{{route('sub-admin.update',['id' => 1])}}" id="edit-sub-admin" method="POST" enctype="multipart/form-data">
</form>
Current Output
<form action="http://localhost:8000/admin/sub-admin" id="edit-sub-admin" method="POST" enctype="multipart/form-data">
</form>
Expected Output
<form action="http://localhost:8000/admin/sub-admin/1" id="edit-sub-admin" method="POST" enctype="multipart/form-data">
</form>
Can anyone help me out ?
Upvotes: 2
Views: 3761
Reputation: 47
//web routes
Route::post('update/{$id}', 'ControllerName@functionName');
Upvotes: 0
Reputation: 1814
Try this code..
<form action="{{route('sub-admin.update',['id' => 1])}}" method="POST" enctype="multipart/form-data"></form>
OR
<form action="{{route('sub-admin.update',1)}}" method="POST" enctype="multipart/form-data"></form>
Your resource route should be like this..
Route::resource('sub-admin', 'SubAdminController');
Upvotes: 1
Reputation: 5659
No need to put the id
on array. Just use the id
as a second parameter of route()
function.
Example:
<form action="{{route('sub-admin.update',1)}}" id="edit-sub-admin" method="POST" enctype="multipart/form-data">
</form>
Upvotes: 2
Reputation: 99
Try using the id instead of id => some value
<form action="{{route('sub-admin.update',[1])}}" id="edit-sub-admin" method="POST" enctype="multipart/form-data">
Upvotes: 0