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
Related
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.
I'm trying to run this command in Laravel 8.57.0 but it's not working:
PHP artisan make:auth
and the error is :
Command "make:auth" is not defined
Did you mean one of these?
make:test
make:request
make:migration
make:seeder
make:middleware
make:controller
make:provider
make:policy
make:event
make:console
make:job
make:listener
make:model
make:command
I also tried
composer require laravel/ui
php artisan ui vue --auth
php artisan migrate
but still have the same error. So, I guess that either I am using the wrong command or I am trying to do something that can not be done. Maybe most likely experienced people will see right away what is wrong.
What are you trying to do exactly? Create the authentication scaffolding from the laravel/ui package?
If so, then these two commands should be enough:
composer require laravel/ui
php artisan ui vue --auth
You can read further about it here.
Since Laravel >= 6, the command php artisan make:auth was removed from the core and moved to an individual package called laravel/ui, so the command now looks like: php artisan ui vue --auth.
Depending on what you want to accomplish I can recommend you the following solutions:
Check this answer, this may be marked as duplicated: php artisan make:auth command is not defined
Run composer dump-autoload and php artisan optimize
Try a different package, like Laravel Fortify
Why don't you try using the fortify package for authentication?
composer require laravel/fortify
The details can be found here.
Why dont you use Laravel Sanctum
composer require laravel/sanctum
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.
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
I have installed the latest version of laravel 5.1.19.
I've tried running:
php artisan make:auth
But it's returning:
[InvalidArgumentException]
Command "make:auth" is not defined.
Did you mean one of these?
make:test
make:request
make:migration
make:seeder
make:middleware
make:controller
make:provider
make:policy
make:event
make:console
make:job
make:listener
make:model
make:command
Is this command no longer available?
I'm on a mac os x by the way.
Yes, that command is not available as the Auth feature comes default by the laravel/laravel package.
If you check the Illuminate/Auth/Console, which is the place of console commands for the auth package, you will only see that the only available command is auth:clear-resets
You can see from the commit that make:auth has been removed for a year.
Check your Laravel Version if your vesion similar to 6.0.*
then, follow these steps -
use this command composer require laravel/ui
php artisan ui vue --auth
npm install then npm run dev
this is use for latest laravel version 6.0.*
php artisan make:auth is not available in laravel 5.1
try to update your composer ( composer update ) and check in your file composer.json if
laravel 5.2
If any one needs make::auth in laravel 6.0,
php artisan make:auth is not available in laravel 6.0
try this
composer require laravel/ui
php artisan ui vue --auth