Updates To Laravel Route File Have No Effect
I am trying to create a view to display data from the database but I discovered that my route file doesn't do anything anymore.
At the moment I am trying to get the test function working but when I go to /test
it just says "Page not found". The other routes work. Even if I delete all of the contents and save the file, all the other routes work.
I have tried artisan route:clear
, artisan cache:clear
and so on but nothing works.
This is my route file.
Route::get('/test', function () {
return "ok";
});//this is not workig
Route::get( '/', function () {
return view( 'welcome' );
} );
Route::resource( 'submission', 'SubmissionController' );
Answer
When you execute php artisan route:cache
, Laravel creates a cached routes file in the bootstrap/cache/routes.php
directory. While this file exists all your other apps route files will be ignored.
Anytime you create new routes you will need to re-generate the routes cache by executing php artisan route:cache
.
If you need to remove the route cache you can execute php artisan route:clear
.
If the above fails to solve your problem, it could indicate a permissions problem. Make sure the bootstrap/cache
directory has the correct permissions to be altered/deleted.
Failing that, you could manually delete the bootstrap/cache/routes.php
file yourself.
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?