I’m using Laravel to build a package which will include some Admin functionality and will include some other packages.
I have included a package which has migrations and a config file, But how do I copy those to the correct folder in Laravel. The package has it’s own ServiceProvider but How do I call that from my package?
I’m using the following to register the package in my package.
class CldServiceProvider extends ServiceProvider { public function register() { $this->app->register(MediaLibraryServiceProvider::class); } }
I’ve tried
php artisan vendor:publish
But it says there’s nothing to publish. Because it’s only looking at the packages for this Laravel installation, and not the nested packages.
Advertisement
Answer
In my case I found I needed to include MY package in the application I was working on. This step was not included in the original tutorial I followed.
So in composer.json
in the main app:
"repositories": [ { "type": "path", "url": "packages/namespace/name", "options": { "symlink": true } } ], "require": { // ... "namespace/name": "dev-master" },
And then we run this command from main folder:
composer update
After that running php artisan vendor:publish
will include the option to publish the sub packages.
NB: The source for this info is: https://laraveldaily.com/how-to-create-a-laravel-5-package-in-10-easy-steps/