Support the ongoing development of Laravel.io →
Eloquent Packages
Last updated 2 years ago.
0

Package stuff was removed. View stuff remains afaik, but other than that nothing.

0

So how resolve the problem ? Thanks.

0

Wait for taylor to re-add the package code or to update the docs to tell us how packages should be done. Any package that uses package() will fail (Which is pretty much all of them). Nothing to do but wait I'm afraid.

0

Package stuff was removed.

This means it is not being re-added. So waiting for Taylor to add it back is only going to waste your time.

0

There is currently no way to manage it. You can't even use the --path option.

I'm really hoping these options come back because frankly, it's a kick in the gut to packages that like to automate install processes for users. I've tried numerous options to get migrations going, and the best I could come up with was to copy your package migrations into the migrations folder in the app.

What's even worse, however - is if you have some sort of migration setup specific to your tests - there is currently no way to make them work, at all.

0

I truly believe that the only things that need to be fixed before a Beta tag in L5 is this issue and also the global CSRF filter (or an easy work-around for calls which CSRF should not be applied)

0

I got it. Just now.

In your packages, you need to do something like this:

$migrations = $this->app->make('migration.repository');
$migrations->createRepository();

$migrator = $this->app->make('migrator');
$migrator->run(__DIR__.'/../src/migrations');
$migrator->run(__DIR__.'/Fixtures/Migrations');

I'm running this inside a custom command right now, called shift:migrate.

It ensures the migrations table is there, and then runs through the migrations necessary for the package, and the migrations I've setup for the full test suite.

Last updated 9 years ago.
0

I think that the better way right know is to create a command name install:package and inside it to run all migration, publish files, etc.

0

In your documentation just tell users to specify the migration path

./artisan migrate --path=vendor/rtconner/laravel-tagging/migrations
0

Or you could publish your migrations in your ServiceProvider's boot method

$this->publishes([
    realpath(__DIR__.'/path/to/migrations') => $this->app->databasePath().'/migrations',
]);

Once a user calls vendor:publish the migration files will be moved and he'll be able to run migrate with your migrations included.

0

^ yup, this is now the preferred and documented method.

0

I tried the above approach. Once i publish the package and run composer dump-autoload, i am getting the below error.

Generating autoload files Warning: Ambiguous class resolution, "xyz" was found in both "<first_file_path>" and "<Second_file_path>", the first will be used.

If i run migrate command, exception 'Symfony\Component\Debug\Exception\FatalErrorException' with message 'Cannot redeclare class XYZ'

How to resolve this.

Thanks in advance.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.