Laravel Routes returning a 404 with route parameters

Hard Tacos

This is not the first time that I have used route parameters in laravel, however I cannot seem to get this to work.

Route:

Route::group(['prefix' => 'admin', 'before' => 'auth|beta|admin'], function()
{
    Route::post('remove/{$id}', ['uses' => 'AdminController@postRemoveID', 'as' => 'admin.postremoveid']);
});

Controller:

public function postRemoveID($id)
 {
    $remove = ServiceProvider::where('id','=',$id)->first();
    $remove->delete();

    return Redirect::route('admin.manage'); //This just redirects to the page the user is currently on
 }

Blade:

<a href="{{ route('admin.postremoveid', $id) }}">
    <i class="fa fa-times"></i>
</a>

What would be causing my site to be redirecting to a 404?

Thanks for all your help!! -Patrick

mydo47

Use Route:get();

  Route::get('remove/{id}', ['uses' => 'AdminController@getRemoveID', 'as' => 'admin.postremoveid']);

Controller:

public function getRemoveID($id)
 {
    $remove = ServiceProvider::where('id','=',$id)->first();
    $remove->delete();

    return Redirect::route('admin.manage'); //This just redirects to the page the user is currently on
 }

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related