I am seeing 404 NOT FOUND page after trying the code below,
Here is my blade code,
<a href="{{route('admin.delete.article',$article->id)}}" title="Delete" class="btn btn-sm btn-danger"><i class="fa fa-times"></i></a>
Here is my route, the route has a prefix called admin
Route::get('/deletearticle/{$id}','AppHttpControllersBackArticleController@delete')->name('delete.article');
Here is my controller class, which is initially generated as a resource, however for the purpose of deleting a row from the database, a new function called delete is introduced manually. Therefore I am not using the destroy function. I am not introducing a delete method yet, so that I can see the $id on a new page as a test.
class ArticleController extends Controller { public function delete($id) { return $id; } public function destroy($id) { // } }
As you can see above, I am not introducing a delete method yet so that I can see the $id on a new page.. Also when I hower the mouse on the delete link object and click on it, it shows me localhost:8000/admin/deletearticle/9 on the browser, which is correct. But the page is 404 NOT FOUND .
I would be greatful to hear from you, if you have an idea about this problem.
Advertisement
Answer
Route parameters don’t have a $
in their name. {id}
not {$id}
.