Laravel Repository file changes not working - php

I have changed one of my repository files. But the changes doesn't working and still getting errors with referring to old file. I tried clearing the cache, but still not working. Below cache clearings tried.
php artisan config:clear
php artisan config:cache
php artisan cache:clear
php artisan view:clear
php artisan optimize:clear
Clearing the linux cache
htcacheclean
rm -rf /var/www/cache/*
Composer autoload also tried
composer dump-autoload
Is anyone got this issue previously and found solution.

Related

impossible to show laravel debugbar with laravel 6

I have installed laravel/debugbar in my laravel 6 project, however, I don't see it displayed on my page. I have tried several things :
set APP_DEBUG=true in my .env file
run php artisan config:clear, php artisan route:clear, php artisan cache:clear, php artisan config:clear & php artisan vendor:publish
run composer dump-autoload
set enabled => true in config/debugbar.php
add the following in config/app.php
'Barryvdh\Debugbar\ServiceProvider',
'Debugbar' => 'Barryvdh\Debugbar\Facade',
Nothing helps, I still don't see the debugbar
Does somebody have an idea ? It would help an lot :)

Laravel 6 artisan package:discover rename bootstrap/cache/packages

After composer update I got an error:
In Filesystem.php line 146:
rename(/var/www/bootstrap/cache/packages.phpE7r5E4,/var/www/bootstrap/cache
/packages.php): No such file or directory
Artisan commands don't work anymore. Already tried:
composer du
composer install
composer update
I found the problem, my windows docker (version 2.1.0.3) sometimes fails to execute. I don't know how it looks like the packages.php file just got locked. So here is the recipe to fix:
I restarted windows,
deleted all the files inside bootstrap\cache
started the containers
run artisan optimize
run composer du
Everything went back to work like a magic. :)
run this command: composer dump-autoload This command will clean up all compiled files and their paths.
enter this command in your terminal for clear cache: php artisan cache:clear
For me deleting the composer.lock file and then running composer install fixed the issue.
I had the same error and these commands helped me:
1. composer dump-autoload
2. php artisan cache:clear
3. php artisan optimize:clear
Try:
composer dump-autoload
or:
artisan cache:clear
after you update or make changes to composer.json to refresh everything.

Laravel-Permission - permission not found in artisan list - There are no commands defined in the "permission" namespace

Hello Good Developers,
I am using spatie:laravel-permissions package in my application. I have identical code in local machine and production server.
I am having a strange issue with my production environment.
I cannot find permission in list of commands in php artisan list.
When I execute php artisan permission:cache-reset it says
There are no commands defined in the "permission" namespace.
I tried following things to fix this issue
Spatie\Permission\PermissionServiceProvider::class, in app.php
providers
composer update
composer dump-autoload
Cleared all config and application cache.
deleted vendors directory and executed composer install to reinstall all the packages.
Still its not working.
However when I execute dump-autoload it says Discovered Package: spatie/laravel-permission
I am using Laravel 5.7.28 and spatie/laravel-permission:^2.5
My Local system is working fine and I can see permission command in the list there.
Please help! I don't know where should I check now.
Try to run this command:
php artisan optimize:clear
If, for some reason, the command doesn't work, run these one by one:
php artisan view:clear
php artisan cache:clear
php artisan route:clear
php artisan config:clear
php artisan clear-compiled
After one of the above steps, if you are in production environment, run: php artisan config:cache

Laravel clear package auto-discovery cache of composer packages

I wanted to remove a package from laravel. I did composer remove vendor/package
It was all good on my dev, but when I deploy on production something went wrong and I cannot do anything now.
when I run
php artisan package:discover
I'm geting
In ProviderRepository.php line 208:
Class 'Laracasts\Flash\FlashServiceProvider' not found
I'm guessing I it is something to do with some kind of cache or maby config
but I cannot run this command,
php artisan config:clear
because I'm getting the same error message as above.
PS. I'm using Laravel 5.6
You may need clear the autoloader files if they get jammed up as it is looking at those cached files when php artisan config:clear runs, thus creating the jam.
Remove the following files and they will rebuild:
/bootstrap/cache/packages.php
/bootstrap/cache/services.php
I fixed my problem deleting a config file like so:
$rm bootstrap/cache/config.php
This file is basically a cache for config, if you want to have this file built for you just run a following artisan command:
$php artisan config:cache

Fatal error: Class 'LaravelLocalization' not found after composer install in production

It's been 3 days since I'm working on translating my site, so I installed LaravelLocalization:
I did everything working in local, then I pushed it in production and executed:
composer install --no-interaction --no-dev
php artisan clear-compiled
php artisan optimize
composer dump-autoload -o
php artisan route:cache
php artisan config:cache
Now, all the "php artisan commands fail with:"
[Symfony\Component\Debug\Exception\FatalThrowableError]
Fatal error: Class 'LaravelLocalization' not found
In this case, in the composer install script, it fails in:
php artisan clear-compiled
I tried to run:
php artisan cache:clear
php artisan route:clear
But without any results...
Any ideas??? This is not the first time I get this kind of stuff, but I may say that this it's a pain in the ass :(
EDIT:
In my routes.php,
I deleted this line:
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect']],
around all my routes, and now composer install works.
But it doesn't solve my issue, because as soon as I put it back, I still get the same error :(
I resolved it removing the line:
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['localeSessionRedirect', 'localizationRedirect']],
in my file routes.php
run again
composer install
and finally
php artisan config:clear
php artisan route:clear
What I don't know is why it happened, and if there is a way to prevent it...
as what the error says, it means that the composer can't locate your package. so be sure to
check your config/app.php file
be sure to put the package in providers and aliases arrays, respectively.
This has been a known issue for a while, but has actually finally been resolved recently. You can read about the issue here.
Basically, running php artisan loads the entire framework, including the cached files. Since the cached files don't have your service provider, you get the error. This includes running php artisan clear-compiled. So, it is using the cached files in the command that is used to delete the cached files.
This issue has finally been resolved as of laravel/framework:v5.2.25 and laravel/laravel:v5.2.27, and backported to laravel/framework:v5.1.33 and laravel/laravel:v5.1.33.
This fix includes a change to the Laravel application (laravel/laravel), in addition to the Laravel Framework (laravel/framework). To implement, you will need to:
1) Update the scripts section of your composer.json file to match that in the laravel/laravel package. Specifically:
remove the pre-update-cmd section
in the post-install-cmd section, replace "php artisan clear-compiled" with "Illuminate\\Foundation\\ComposerScripts::postInstall"
in the post-update-cmd section, replace "php artisan clear-compiled" with "Illuminate\\Foundation\\ComposerScripts::postUpdate"
2) Once you have updated your composer.json, run a composer update. If you only want to update the framework, you can run composer update laravel/framework.

Categories