Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
webbingbrasil/exams-module / Providers / ExamsServiceProvider.php
Size: Mime:
<?php namespace Modules\Exams\Providers;

use Illuminate\Support\ServiceProvider;
use Modules\Exams\Http\Controllers\ExamsController;
use Modules\Exams\Policies\ExamsPolicy;

class ExamsServiceProvider extends ServiceProvider
{

    /**
     * Indicates if loading of the provider is deferred.
     *
     * @var bool
     */
    protected $defer = false;

    /**
     * The policy mappings for the application.
     *
     * @var array
     */
    protected $policies = [
        ExamsController::class => ExamsPolicy::class
    ];

    /**
     * Boot the application events.
     *
     * @return void
     */
    public function boot()
    {
        $this->registerTranslations();
        $this->registerConfig();
        $this->registerViews();
    }

    /**
     * Register translations.
     *
     * @return void
     */
    public function registerTranslations()
    {
        $langPath = base_path('resources/lang/modules/exams');

        if (is_dir($langPath)) {
            $this->loadTranslationsFrom($langPath, 'exams');
            $this->loadTranslationsFrom($langPath, 'questions');
            $this->loadTranslationsFrom($langPath, 'answers');
            $this->loadTranslationsFrom($langPath, 'validation');
        } else {
            $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'exams');
            $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'questions');
            $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'answers');
            $this->loadTranslationsFrom(__DIR__ . '/../Resources/lang', 'validation');
        }
    }

    /**
     * Register config.
     *
     * @return void
     */
    protected function registerConfig()
    {
        $this->publishes([
            __DIR__ . '/../Config/config.php' => config_path('exams.php'),
        ]);
        $this->mergeConfigFrom(
            __DIR__ . '/../Config/config.php', 'exams'
        );
    }

    /**
     * Register views.
     *
     * @return void
     */
    public function registerViews()
    {
        $viewPath = base_path('resources/views/modules/exams');

        $sourcePath = __DIR__ . '/../Resources/views';

        $this->publishes([
            $sourcePath => $viewPath
        ]);

        $this->loadViewsFrom([$viewPath, $sourcePath], 'exams');
    }

    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        // Exams Repository
        $this->app->bind('Modules\Exams\Contracts\Repositories\ExamRepository',
            'Modules\Exams\Repositories\Eloquent\ExamRepositoryEloquent');

        // Questions Repository
        $this->app->bind('Modules\Exams\Contracts\Repositories\QuestionRepository',
            'Modules\Exams\Repositories\Eloquent\QuestionRepositoryEloquent');

        // Answers Repository
        $this->app->bind('Modules\Exams\Contracts\Repositories\AnswerRepository',
            'Modules\Exams\Repositories\Eloquent\AnswerRepositoryEloquent');
    }

    /**
     * Get the services provided by the provider.
     *
     * @return array
     */
    public function provides()
    {
        return array();
    }

}