<commit_before><?php

use Illuminate\Routing\Router;

$router->bind('categories', function($id)
{
    return app('Modules\Blog\Repositories\CategoryRepository')->find($id);
});
$router->bind('posts', function($id)
{
    return app('Modules\Blog\Repositories\PostRepository')->find($id);
});

/*
|--------------------------------------------------------------------------
| Public routes
|--------------------------------------------------------------------------
*/
if (! App::runningInConsole()) {
    $locale = LaravelLocalization::setLocale();
    $router->group([
            'prefix' => $locale,
            'before' => 'LaravelLocalizationRedirectFilter',
            'namespace' => 'Modules\Blog\Http\Controllers'
    ], function (Router $router) use($locale) {
        $routes = app('Asgard.routes');
        if (isset($routes['blog'][$locale])) {
            $uri = $routes['blog'][$locale];
        } else {
            $fallbackLang = Config::get('translatable::fallback_locale');
            $uri = isset($routes['blog']) ? $routes['blog'][$fallbackLang] : 'blog';
        }

        $router->get($uri, ['as' => $locale.'.blog', 'uses' => 'PublicController@index']);
        $router->get($uri.'/{slug}', ['as' => $locale.'.blog.slug', 'uses' => 'PublicController@show']);
    });
}

/*
|--------------------------------------------------------------------------<commit_msg>Update public routes<commit_after><?php

use Illuminate\Routing\Router;

$router->bind('categories', function($id)
{
    return app('Modules\Blog\Repositories\CategoryRepository')->find($id);
});
$router->bind('posts', function($id)
{
    return app('Modules\Blog\Repositories\PostRepository')->find($id);
});

/*
|--------------------------------------------------------------------------
| Public routes
|--------------------------------------------------------------------------
*/
if (! App::runningInConsole()) {
    $locale = LaravelLocalization::setLocale() ?: App::getLocale();
    $router->group([
            'prefix' => $locale,
            'before' => 'LaravelLocalizationRedirectFilter|public.checkLocale',
            'namespace' => 'Modules\Blog\Http\Controllers'
    ], function (Router $router) use($locale) {
        $routes = app('Asgard.routes');
        if (isset($routes['blog'][$locale])) {
            $uri = $routes['blog'][$locale];
        } else {
            $uri = 'blog';
            if (Config::get('app.locale_in_url')) {
                $uri = $locale . '/' . $uri;
            }
        }

        $prefix = Config::get('core::core.admin-prefix');
        $router->get($uri, ['as' => $locale.'.blog', 'uses' => 'PublicController@index'])->where('uri', "(?!$prefix).*");
        $router->get($uri.'/{slug}', ['as' => $locale.'.blog.slug', 'uses' => 'PublicController@show'])->where('uri', "(?!$prefix).*");
    });
}

/*
|--------------------------------------------------------------------------
{'fraction_non_alphanumeric': 0.34373927958833617, 'fraction_numerical': 0.0, 'mean_word_length': 1.828322017458778, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2796172', 'n_tokens_mistral': 777, 'n_tokens_neox': 790, 'n_words': 110}