Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
namespace Functional\Streaks\Providers;
|
||||
|
||||
use Functional\Streaks\Database\Seeders\StreaksSeeder;
|
||||
use Functional\Streaks\Listeners\UpdateStreakOnWorkoutCompleted;
|
||||
use Functional\Streaks\Services\StreakService;
|
||||
use Functional\Tracking\Events\WorkoutCompleted;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Xefi\LaravelOSDD\LayerServiceProvider;
|
||||
|
||||
class StreaksServiceProvider extends LayerServiceProvider
|
||||
{
|
||||
public function boot(): void
|
||||
{
|
||||
if ($this->app->runningInConsole()) {
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../../database/migrations');
|
||||
$this->loadSeeders([StreaksSeeder::class]);
|
||||
}
|
||||
|
||||
$this->withRouting(
|
||||
web: __DIR__ . '/../../routes/web.php',
|
||||
api: __DIR__ . '/../../routes/api.php',
|
||||
commands: __DIR__ . '/../../routes/console.php',
|
||||
channels: __DIR__ . '/../../routes/channels.php',
|
||||
);
|
||||
$this->loadSeeders([\Functional\Streaks\Database\Seeders\StreaksSeeder::class]);
|
||||
|
||||
// Le streak se met à jour à chaque séance terminée (événement porté par la couche tracking).
|
||||
Event::listen(WorkoutCompleted::class, UpdateStreakOnWorkoutCompleted::class);
|
||||
}
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->singleton(StreakService::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user