Home > OS >  I have laravel project working fine in localhost but after i've added new routes, url and views
I have laravel project working fine in localhost but after i've added new routes, url and views

Time:03-14

Can you please assist, I have laravel project working fine in my localhost where am using wamp.The problem arise after uploading the project to cpanel it says 404 Not found to new routes i just added and others works fine. I tried stackoverflow asked questions where the found .htaccess solutions but still didn't help.

Error 404 Not Found Screenshot

**Here is my route**
    Route::get('/admin/accstatements', 'App\Http\Controllers\AdminController@statements')->name('admin.accstatements.index');

Controller

public function statements(Request $request){
    
    $search = $request->input('search'); 
    $custacc =DB::table('customers')
                ->select('customers.*')
                ->where('customers.firstname', 'LIKE', "%{$search}%")
                ->orWhere('customers.surname', 'LIKE', "%{$search}%")
                ->orWhere('customers.idnumber', 'LIKE', "%{$search}%")
                ->orderby('customers.created_at', 'desc')
                ->get();

    return view('admin.statements.index')->with(compact('custacc'));
}

CodePudding user response:

you need to clear route cache in your laravel application. put following code to your route and all request will works fine. now, when you create new route; you just have to run this route.

use Illuminate\Support\Facades\Artisan;

Route::get('/clear-cache', function() {
    Artisan::call('cache:clear');
    return "Cache is cleared";
});

CodePudding user response:

Laravel caching system also takes routes in consideration, to remove route cache in Laravel use the given below command:

php artisan route:cache
  • Related