Support the ongoing development of Laravel.io →
posted 9 years ago
Packages
Last updated 1 year ago.
0

No it will not overwrite. To overwrite you need to use vendor:publish --force

0

I am not asking about overwriting; see example:

  • package A - has many migrations (are copied to db/migrations)
  • package B - has one configure file (that is copied to /config)

When I do vendor:publish with brand new package A and brand new package B, output is that

Copied Directory [/vendor/package/A/src/migrations] To [/database/migrations]
Copied File [/vendor/package/B/src/config/configfile.php] To [/config/confgfile.php]
Publishing Complete!

That is expected behaviour now I run vendor:publish second time and this is the output

Copied Directory [/vendor/package/A/src/migrations] To [/database/migrations]
Publishing Complete!

And question is: is this behaviour of command in question correct?

Last updated 9 years ago.
0

Yes. It did not overwrote the confgfile.php because you defined it as

$this->publishes([
    __DIR__.'/path/to/config/confgfile.php' => config_path('confgfile.php'),
]);
Last updated 9 years ago.
0

I am asking other way around :) Is it correct from vendor:publish overwrite already published stuff (views/migrations...)?

Last updated 9 years ago.
0

hey sorry man. here's my late late reply.

The console says "Copied Directory [/vendor/package/A/src/migrations] To [/database/migrations]" means it actually overwrote the files in the directory. Meaning it will not overwrite your existing migrations files or any other directories.

Also i like to note that if i were you i would place the migration folder and the config folder outside the src. When i develop i keep my classes only inside the src folder and set the composer to autoload psr-4 my src folder. So when composer dumps my autoload namespaces only the needed classes will be there. :)

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Kyslik kyslik Joined 23 Jul 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.