<?php

declare(strict_types=1);

namespace Seka\Portal\Modul\Terminy\Providers;

use Illuminate\Support\Facades\Route;
use Elceka\Laravel\HashId\Facades\Hasher;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

/**
 * Class RouteServiceProvider
 *
 * @package Seka\Portal\Modul\Terminy\Providers
 */
final class RouteServiceProvider extends ServiceProvider
{
    /**
     *
     */
    public function boot()
    {
        parent::boot();

        Route::bind('mtUdalostId', function ($hashId) {
            return Hasher::decode($hashId);
        });

        Route::bind('mtRegistraciaId', function ($hashId) {
            return Hasher::decode($hashId);
        });

        Route::bind('mtMiestoKonaniaId', function ($hashId) {
            return Hasher::decode($hashId);
        });

        $this->routes();
    }

    /**
     *
     */
    protected function routes(): void
    {
        // BACKEND
        $this->loadRoutesFrom(__DIR__ . '/../Routes/backend/web.php');

        // FRONTEND
        $this->loadRoutesFrom(__DIR__ . '/../Routes/frontend/web.php');
    }
}
