app/Providers/AppServiceProvider.php
/**
     * Register any application services.
     *
     * @return void
     */
Register any application services.
@return void
Register any application services . @return void
public function register()
    {
        $this->app->when(PageController::class)
                    ->needs(TitleValidator::class)
                    ->give(function(){
                        return new PageTitleValidator();
                    });
        $this->app->when(SectionController::class)
                    ->needs(TitleValidator::class)
                    ->give(function(){
                        return new SectionTitleValidator();
                    });
        $this->app->when(PostController::class)
                    ->needs(TitleValidator::class)
                    ->give(function(){
                        return new PostTitleValidator();
                    });
    }
public function register ( ) { $ this -> app -> when ( PageController :: class ) -> needs ( TitleValidator :: class ) -> give ( function ( ) { return new PageTitleValidator ( ) ; } ) ; $ this -> app -> when ( SectionController :: class ) -> needs ( TitleValidator :: class ) -> give ( function ( ) { return new SectionTitleValidator ( ) ; } ) ; $ this -> app -> when ( PostController :: class ) -> needs ( TitleValidator :: class ) -> give ( function ( ) { return new PostTitleValidator ( ) ; } ) ; }
Register any application services.
Register any application services .