Why always i clear route and cached route when new created? - laravel

I am using Laravel 8 and I am facing issue with route. When I create a route it does not appear in route list after running below command
php artisan route:clear
php artisan route:cache
I get all route. How can i solve it. Why i run these command for new routes?

From the docs:
Optimizing Route Loading
If you are building a large application with many routes, you should
make sure that you are running the route:cache Artisan command during
your deployment process:
php artisan route:cache
This command reduces all of your route registrations into a single
method call within a cached file, improving the performance of route
registration when registering hundreds of routes.
You should only run php artisan route:cache during deployment, while you develop locally you shouldn't cache your routes, otherwise new routes that you create wont be registered until you run php artisan route:clear or php artisan route:cache again.
php artisan route:cache
// clears the route cache and then re caches the routes
php artisan route:clear
// clears the route cache

Related

I have removed a route from web.php and this route still working in laravel 5

I am working in laravel 5 an existing project downloaded from cpanel. I want to make some changes but my changes do not have any affect. I, at the end remove the route but route still working. There is no any extra route file binding in routeServiceProvider not required or included in web.php. I am wondering how it could be happened?
I have tried:
php aritsan cache:clear
php artisan config:clear
can somebody please tell me what could be the issue ?
please run the following:
php artisan route:cache
After running this command, your cached routes file will be loaded on every request.
Please, run the following command:
php artisan route:clear

Laravel routes not updating on server

I have added a Laravel route to the web.php file and everything works fine locally but on deployment, it says that page is not found. The thing is that the newly added routes seem to be in web.php on the server as well but php artisan route:list does not display these new routes. Most of the solutions here recommend to run php artisan route:clear and then php artisan route:cache but there is not any routes.php file in /bootstrap/cache/ directory so that routes were not caching anyways.
Dont run route:cache
just clear and it will auto get it cached from your routes
php artisan route:clear
php artisan config:clear

Why am I getting this error with laravel websocket library?

am trying to set up a web sockets server using laravel 5.7 and keep getting this error
Argument 2 passed to
BeyondCode\LaravelWebSockets\Apps\App::__construct() must be of the
type string, null given, called in
/opt/lampp/htdocs/api.cs/vendor/beyondcode/laravel-websockets/src/Apps/ConfigAppProvider.php
on line 63 screenshot missing
....i don't know what to do please help. I'm actually using this guide https://docs.beyondco.de/laravel-websockets/1.0/
Try clearing your cache:
Run
php artisan config:cache
Or
php artisan optimize:clear
After running migration use the following sequence of commands:
php artisan cache:clear
php artisan config:clear
php artisan config:cache

How to change Base URl of a website - Laravel 5.4

I have a website based on laravel 5.4. The site is working fine on my localhost. But when I upload it on my shared hosting. It is giving me an error
"at FileViewFinder->findInPaths('welcome', array('C:\\xampp\\htdocs\\lrl\\resources\\views'))"
C:\xampp\htdocs\lrl\resources\views this is my localhost URL. How can I changed this URl. I have made changes in .env file and I put all the files of public folder at root directory. Also I changed Appserviceprovider.php file.
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Schema;
use DB;
use View;
use Request;
I also cleared the cache but still i am getting this error shown in screenshot
run php artisan config:cache
C:\xampp\htdocs\lrl\resources\views is cached in your config file. So, you must clear config cache by run artisan command php artisan config:cache.
Clear you route cache
php artisan route:cache
Clear all if still not work
php artisan config:cache
php artisan config:clear
php artisan view:clear

Route voyager posts index not defined

I just have installed voyager at laravel 5.4 and tables migrated but at the end it shows following error
Route [voyager.posts.index] not defined
As mentioned by #Muhammad Muazzam
1- Run php artisan voyager:install
However, only this didn't work for me, I needed to also
2- Clear php catch: php artisan optimize:clear
Re runing php artisan voyager:install will resolve the issue.

Resources