Search code examples
laravelvue.jslaravel-routinglaravel-vue

Route keep asking for parameter even if not set to receive any


I'm new to laravel and I'm having trouble with one of my web routes...

I grouped some routes with the auth middleware

Route::middleware(['auth:web'])->group(function ($router) {

    Route::get('/news', [NewsController::class, 'news'])->name('news');
    Route::get('/profile/{user_id}', [ProfileController::class, 'profile'])->name('profile');
    Route::get('/marketplace', [MarketplaceController::class, 'marketplace'])->name('marketplace');

});

Before this issue, I have set a user_id parameter for the news route and then removed it the next day, now the news route keeps returning error saying it needs user_id.

here's my controller:

    <?php

namespace App\Http\Controllers;

class NewsController extends Controller
{

    public function news() {

        return view('modules.news.news');

    }
}

and since im using laravel-vue mix, my modules.news.news view looks like this:

@section('content')
    <newsfeed inline-template>
        <div>
            ...
            ...
        </div>
    </newsfeed>
@endsection

I've checked the web route, the controller, the blade, and I really can't see anything that requiring the news route to receive a parameter.

can someone point out where I went wrong?


Solution

  • Your route file might be cached, try running php artisan route:clear and see if this fixes the issue.