Files
streakfit-api/functional/streaks/src/Providers/StreaksServiceProvider.php
T
neckfireandClaude Opus 4.8 fa3e59704b
Build & Deploy / build (push) Successful in 17s
i18n vocabulaire exos (fr/pt-BR) + Web Push rappels de série
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 03:46:43 +02:00

39 lines
1.3 KiB
PHP

<?php
namespace Functional\Streaks\Providers;
use Functional\Streaks\Console\Commands\RemindStreaksCommand;
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->commands([RemindStreaksCommand::class]);
}
$this->withRouting(
web: __DIR__ . '/../../routes/web.php',
api: __DIR__ . '/../../routes/api.php',
commands: __DIR__ . '/../../routes/console.php',
channels: __DIR__ . '/../../routes/channels.php',
);
// 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);
}
}