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

Supply the CalendarDataProvider to the CalendarController per instance instead of through global dependency injection #3

Closed
wdelfuego opened this issue Apr 25, 2022 · 4 comments
Labels
enhancement New feature or request implemented

Comments

@wdelfuego
Copy link
Owner

Right now, the CalendarController expects a CalendarDataProviderInterface which is supplied through dependency injection.

For that to work, users of this package need to manually bind their own calendar data provider to the CalendarDataProviderInterface class in the boot() method of their NovaServiceProvider:

use App\Providers\CalendarDataProvider;

public function register()
{
    $this->app->bind(CalendarDataProviderInterface::class, function($app) {
        return new CalendarDataProvider();
    });
}

It would be nice if instead, the calendar data provider could be supplied through the tool's constructor within the tools() method, like this:

use App\Providers\CalendarDataProvider;

public function tools()
{
    return [
        new NovaCalendar(new CalendarDataProvider),
    ];
}

That would open the door to having multiple instances of the calendar Tool, each with their own data provider. It would have the added benefit of making the installation of the package slightly simpler.

Any questions or doubts?

Add a comment to this issue and we'll talk about it.

@wdelfuego wdelfuego added enhancement New feature or request good first issue Good for newcomers labels Apr 25, 2022
@wdelfuego wdelfuego removed the good first issue Good for newcomers label Jun 16, 2022
@Violet-Vibes
Copy link

This is something I would definitely use as it'd allow me to separate certain types of events into their own calendar as currently some days can get very "cluttered" when there's a ton of stuff going on.

@wdelfuego
Copy link
Owner Author

I've been playing with this and have to choose from several approaches. Will probably be released in version 2.0 together with PHP7 support because I don't think I can do this without introducing breaking changes.

@vesper8

This comment was marked as off-topic.

@wdelfuego
Copy link
Owner Author

Will be released in 2.0 for sure, already available on the dev branch

wdelfuego pushed a commit that referenced this issue Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request implemented
Projects
None yet
Development

No branches or pull requests

3 participants