<commit_before><?php

namespace Philsquare\LaraManager\Providers;

//use Illuminate\Contracts\Config\Repository as Config;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use Suin\RSSWriter\Feed;

class LaraManagerServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');

        $router->middleware('admin', \Philsquare\LaraManager\Http\Middleware\AdminMiddleware::class);
        $router->middleware('guest.admin', \Philsquare\LaraManager\Http\Middleware\RedirectIfAuthenticated::class);

        $this->loadViewsFrom(__DIR__.'/../../../views', 'laramanager');

        $this->assetsToPublish();

        $this->setViewComposers();

        $this->loadTranslationsFrom(__DIR__.'/../../../lang', 'laramanager');

        Validator::extend('unique_filename', 'Philsquare\LaraManager\Validators\UniqueFilenameValidator@validate');
        Validator::extend('model_must_exist', 'Philsquare\LaraManager\Validators\ModelMustExistValidator@validate');
        Validator::replacer('model_must_exist', function($message, $attribute, $rule, $parameters) {
            return trans('laramanager::validation.model_must_exist');
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom(__DIR__.'/../../../config/imagecache/templates.php', 'imagecache.templates');
        $this->mergeConfigFrom(__DIR__.'/../../../config/imagecache/paths.php', 'imagecache.paths');
        config(['imagecache.route' => 'images']);
    }

    private function assetsToPublish()
    {
        $this->publishes([
            __DIR__. '/../../../config/config.php' => config_path('laramanager.php'),
        ]);

        $this->publishes([
            __DIR__ . '/../../../assets/' => public_path('vendor/laramanager/'),
        ], 'public');

        $this->publishes([
            __DIR__ . '/../../../database/migrations/' => database_path('migrations')
        ], 'migrations');
    }

    private function setViewComposers()
    {
        view()->composer('laramanager::navigations.top.index', 'Philsquare\LaraManager\ViewComposers\NavigationComposer');
        view()->composer('laramanager::navigations.primary.*', 'Philsquare\LaraManager\ViewComposers\NavigationComposer');
        view()->composer('laramanager::layouts.*', 'Philsquare\LaraManager\ViewComposers\LayoutsViewComposer');
    }
}
<commit_msg>fixed middleware to load automatically in provider<commit_after><?php

namespace Philsquare\LaraManager\Providers;

//use Illuminate\Contracts\Config\Repository as Config;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\ServiceProvider;
use Suin\RSSWriter\Feed;

class LaraManagerServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot(Router $router)
    {
        $this->loadRoutesFrom(__DIR__ . '/../Http/routes.php');

        $this->loadViewsFrom(__DIR__.'/../../../views', 'laramanager');

        $this->assetsToPublish();

        $this->setViewComposers();

        $this->loadTranslationsFrom(__DIR__.'/../../../lang', 'laramanager');

        Validator::extend('unique_filename', 'Philsquare\LaraManager\Validators\UniqueFilenameValidator@validate');
        Validator::extend('model_must_exist', 'Philsquare\LaraManager\Validators\ModelMustExistValidator@validate');
        Validator::replacer('model_must_exist', function($message, $attribute, $rule, $parameters) {
            return trans('laramanager::validation.model_must_exist');
        });
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->app['router']->aliasMiddleware('admin', \Philsquare\LaraManager\Http\Middleware\AdminMiddleware::class);
        $this->app['router']->aliasMiddleware('guest.admin', \Philsquare\LaraManager\Http\Middleware\RedirectIfAuthenticated::class);

        $this->mergeConfigFrom(__DIR__.'/../../../config/imagecache/templates.php', 'imagecache.templates');
        $this->mergeConfigFrom(__DIR__.'/../../../config/imagecache/paths.php', 'imagecache.paths');
        config(['imagecache.route' => 'images']);
    }

    private function assetsToPublish()
    {
        $this->publishes([
            __DIR__. '/../../../config/config.php' => config_path('laramanager.php'),
        ]);

        $this->publishes([
            __DIR__ . '/../../../assets/' => public_path('vendor/laramanager/'),
        ], 'public');

        $this->publishes([
            __DIR__ . '/../../../database/migrations/' => database_path('migrations')
        ], 'migrations');
    }

    private function setViewComposers()
    {
        view()->composer('laramanager::navigations.top.index', 'Philsquare\LaraManager\ViewComposers\NavigationComposer');
        view()->composer('laramanager::navigations.primary.*', 'Philsquare\LaraManager\ViewComposers\NavigationComposer');
        view()->composer('laramanager::layouts.*', 'Philsquare\LaraManager\ViewComposers\LayoutsViewComposer');
    }
}

{'fraction_non_alphanumeric': 0.16694245265673838, 'fraction_numerical': 0.0, 'mean_word_length': 3.2072699149265276, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 43, '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': '139119', 'n_tokens_mistral': 1586, 'n_tokens_neox': 1575, 'n_words': 196}