nebulapackage / nebula

Nebula is a minimalistic and easy to use administration tool for Laravel applications, made with Laravel, Alpine.js, and Tailwind CSS.
https://nebulapackage.com
227 stars 27 forks source link

feature: manual register methods #38

Closed ryangjchandler closed 3 years ago

ryangjchandler commented 3 years ago

This PR adds 6 new methods to a brand new Nebula class in the root of the package. This class will act as the central source of truth for resources, dashboards and now pages.

Nebula::resources() - used to register an array of resources:

Nebula::resources([
    ExampleResource::class,
]);

Nebula::availableResources() - used to retrieve the array of available / registered resources.

There are equivalent methods for dashboards and pages too. This will allow developers to manually register resources inside of a service providers boot method, and will also create a new place for more filtering based on permissions, etc in the future.

ryangjchandler commented 3 years ago

I've just pushed a change that will let users use either the fully-qualified name of the class, e.g. ExampleResource::class, during registration or provide an instance, new ExampleResource.

Larsklopstra commented 3 years ago

👌