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

Backward compatibility with Laravel 5.2 and Laravel 5.3 #32

Merged
merged 2 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Command/BaseConsumerCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class BaseConsumerCommand extends Command
*/
protected function getConsumer(string $consumerAliasName): ConsumerInterface
{
return app()->makeWith(ConsumerInterface::class, [$consumerAliasName]);
return app()->make(ConsumerInterface::class, [$consumerAliasName]);
}

/**
Expand Down
16 changes: 12 additions & 4 deletions src/Providers/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,25 @@ class ServiceProvider extends LaravelServiceProvider
protected $defer = false;

/**
* Perform post-registration booting of services.
* Register services.
*
* @return void
* @throws LaravelRabbitMqException
*/
public function boot()
public function register()
Copy link
Contributor Author

@bogdanghervan bogdanghervan May 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm declaring register() which is an abstract method in the base service provider in Laravel 5.2. Also, I deemed it safe to move the methods that bind stuff to the service container here.

publishConfig and registerCommands are still better located inside the boot() method according to the Laravel docs on packages.

{
$this->publishConfig();
$this->registerContainer();
$this->registerPublishers();
$this->registerConsumers();
}

/**
* Perform post-registration booting of services.
*
* @return void
*/
public function boot()
{
$this->publishConfig();
$this->registerCommands();
}

Expand Down