Answer the question
In order to leave comments, you need to log in
How to correctly specify the public folder from vendor in the service provider of your package?
Hello. Started developing my package. Set up a symlink to my package in composer.json (which is at the root):
"repositories": {
"package-name": {
"type": "path" ,
"url": "packages/sequelone/sone" ,
"options": {
"symlink": true
}
}
},
namespace Sequelone\Sone;
use Illuminate\Support\ServiceProvider;
class SoneServiceProvider extends ServiceProvider
{
public function boot()
{
$this->publishes([
__DIR__.'/../config/sone.php' => config_path('sone.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../config/sone.php', 'sone'
);
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
$this->loadViewsFrom(__DIR__.'/../resources/views/', 'sone');
$this->publishes([
__DIR__ . '/../../views' => base_path('resources/views/vendor/sone')
]);
$this->publishes([
__DIR__ . '/../../vendor/sequelone/sone/public' => public_path('vendor/sone'),
], 'public');
$this->publishes([
__DIR__.'/../public' => public_path('/'),
], 'public');
}
}
$this->publishes([
__DIR__ . '/../../vendor/sequelone/sone/public' => public_path('vendor/sone'),
], 'public');
php artisan vendor:publish --tag=public --force
Answer the question
In order to leave comments, you need to log in
Apparently nothing will work without publications in the main folder. The solution is this.
In the service provider of your package, write the path to publication:
$this->publishes([
__DIR__ . '/../public' => public_path('vendor/sone'),
], 'Sone-public');
"scripts": {
"post-install-cmd": [
"...",
"php artisan vendor:publish --tag=public --force"
],
"post-update-cmd": [
"...",
"php artisan vendor:publish --tag=public --force"
],
},
Have you looked here?
https://laravel.demiart.ru/package-development/
https://laravel.demiart.ru/build-your-own-laravel-...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question