Laravel "php artisan vendor:publish" not creating the config file from the package to be copied over to the main project if the file already exist. My problem is that I usually update some configs in my package and running the vendor:publish doesn't copy the file to the main app because I previously executed the command.
php artisan vendor:publish --help would show you the help information for the command. First option is
--force Overwrite any existing files
So use
php artisan vendor:publish --force
to ... overwrite existing files.
Related
I tried to customize the component of mail on Laravel 5.8. At first I tried to copy mail directory from Illuminate/Mail to resources/views using command
php artisan vendor:publish --tag=laravel-mail
but it didn't create anything, although it generated the success message
Copied Directory [/vendor/laravel/framework/src/Illuminate/Mail/resources/views] To [/resources/views/vendor/mail]
Publishing complete.
Why did it happens? I don't have any clue.
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
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
I want to install quickadmin to create a quick admin panel, I am using Laravel 5.3 and I have followed the step to install:
Create new project
composer create-project laravel/laravel ProjectName --prefer-dist
2.Install quickadmin
composer require laraveldaily/quickadmin
Add Laraveldaily\Quickadmin\QuickadminServiceProvider::class, to your \config\app.php providers after App\Providers\RouteServiceProvider::class,
Configure your .env file with correct database information
Run php artisan quickadmin:install and fill the required information.
but this error appear
[Symfony\Component\Debug\Exception\FatalThrowableError]
Class 'Laraveldaily\Quickadmin\QuickadminServiceProvider' not found
What's happend?
I think you left one step and that is clear the cache. Please try after clear the cache.
You can run following command after 3rd step :
php artisan config:cache
php artisan config:clear
php artisan cache:clear
These steps can be followed to install quickadminpanel without any difficulty
composer create-project laravel/laravel ProjectName --prefer-dist
cd ProjectName
php artisan clear-compiled
composer require laraveldaily/quickadmin
php artisan clear-compiled
Open:
config/app.php
insert in the $providers array after Illuminate\View\ViewServiceProvider::class,
Laraveldaily\Quickadmin\QuickadminServiceProvider::class,
Open:
config/app.php
insert
Laraveldaily\Quickadmin\QuickadminServiceProvider::class,
Open:
app/Providers/AppServiceProvider.php
insert after use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Schema;
insert in boot() function
Schema::defaultStringLength(191);
Create a database(if you are using something like xampp, create it in phpmyadmin)
Modify .env file to add database configurations, db name(the one which you created),
username(usually root), password
php artisan config:cache
php artisan config:clear
php artisan quickadmin:install
enter admin email and password (will be used to login to quickadminpanel everytime, so choose ones you can easily remember)
Open:
App\Http\Kernel.php
insert in the $routeMiddleware array
'role' => \Laraveldaily\Quickadmin\Middleware\HasPermissions::class,
php artisan serve
Open browser, url: localhost:8000/admin
How can I make PHP's artisan vendor:publish command to merge the new file with the existing file instead overwriting in Laravel? Or after a make:console merge, how can I use the vendor:publish command in it?
I ask because PHP's artisan vendor:publish --force overwrites packages view for a resource.
PHP artisan does't publish files. If it is already published then only look for new files (don't use --force). Also, you can use
php artisan vendor:publish --provider="Vendor\Providers\PackageServiceProvider"
to specify package