| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Faithgen\Discussions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Faithgen\Discussions\Models\Discussion; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Faithgen\Discussions\Observers\DiscussionObserver; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use FaithGen\SDK\Traits\ConfigTrait; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Illuminate\Support\ServiceProvider; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 9 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  | class DiscussionsServiceProvider extends ServiceProvider | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |     use ConfigTrait; | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |      * Bootstrap the application services. | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |     public function boot() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |         $this->registerRoutes(__DIR__.'/../routes/discussions.php', __DIR__.'/../routes/source.php'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |         $this->setUpSourceFiles(function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |             $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |             $this->publishes([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |                 __DIR__.'/../config/config.php' => config_path('discussions.php'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |             ], 'faithgen-discussions-config'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |             $this->publishes([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |                 __DIR__.'/../database/migrations' => database_path('migrations'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |             ], 'faithgen-discussions-migrations'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |             $this->publishes([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |                 __DIR__.'/../storage' => storage_path('app/public'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |             ], 'faithgen-discussions-storage'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         }); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |         Discussion::observe(DiscussionObserver::class); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 38 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |      * Register the application services. | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     public function register() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         // Automatically apply the package configuration | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         $this->mergeConfigFrom(__DIR__.'/../config/config.php', 'faithgen-discussions'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |         // Register the main class to use with the facade | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         $this->app->singleton('discussions', function () { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |             return new Discussions; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |         }); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 52 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |     public function routeConfiguration(): array | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |         return [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |             'prefix'     => config('faithgen-discussions.prefix'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |             'middleware' => config('faithgen-discussions.middlewares'), | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         ]; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 60 |  |  |     } | 
            
                                                        
            
                                    
            
            
                | 61 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 62 |  |  |  |