0 votes
in Laravel by
What is the register and boot method in the Service Provider class?

1 Answer

0 votes
by

The register method in the Service Provider class is used to bind classes or services to the Service Container. It should not be used to access any other functionality or classes from the application as the service you are accessing may not have loaded yet into the container.

The boot method runs after all the dependencies have been included in the container and now we can access any functionality in the boot method. Like you can create routes, create a view composer, etc in the boot method.

Related questions

+1 vote
asked Aug 12, 2019 in Service Discovery by Venkatshastri
0 votes
asked Mar 17, 2020 in Cloud Computing by SakshiSharma
...