Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue running tenants:artisan commands within the app code #207

Closed
michaeldaly opened this issue Mar 15, 2021 · 2 comments
Closed

Issue running tenants:artisan commands within the app code #207

michaeldaly opened this issue Mar 15, 2021 · 2 comments

Comments

@michaeldaly
Copy link

I discovered an issue when trying to execute an Artisan command within the context of the app (not the console).

An example command:

Artisan::call('tenants:artisan', [
    'artisanCommand' => "'migrate --database=tenant'",
    '--tenant' => 3,
]);

Returns the following error:

The command "tenants:artisan" does not exist.  

I was able to temporarily fix the problem by commenting out the if ($this->app->runningInConsole()) { line of the PackageServiceProvider.php: https://github.com/spatie/laravel-package-tools/blob/master/src/PackageServiceProvider.php#L44

Has anyone come across this issue and can you advise on a more permanent fix?

@michaeldaly
Copy link
Author

I have raised a PR for the Package Tools component which I hope will resolve this issue: spatie/laravel-package-tools#23

@michaeldaly
Copy link
Author

michaeldaly commented Mar 16, 2021

This can now be closed since the merged PR to the spatie/laravel-package-tools project will resolve the issue.

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant