| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Soved\Laravel\Gdpr; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Illuminate\Support\Facades\Route; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Illuminate\Support\ServiceProvider; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Soved\Laravel\Gdpr\Console\Commands\Cleanup; | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 9 |  |  | class GdprServiceProvider extends ServiceProvider | 
            
                                                                        
                            
            
                                    
            
            
                | 10 |  |  | { | 
            
                                                                        
                            
            
                                    
            
            
                | 11 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 12 |  |  |      * Bootstrap the application services. | 
            
                                                                        
                            
            
                                    
            
            
                | 13 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 14 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 15 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 16 |  |  |     public function boot() | 
            
                                                                        
                            
            
                                    
            
            
                | 17 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 18 |  |  |         $this->registerRoutes(); | 
            
                                                                        
                            
            
                                    
            
            
                | 19 |  |  |         $this->registerCommands(); | 
            
                                                                        
                            
            
                                    
            
            
                | 20 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 21 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 22 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 23 |  |  |      * Register the GDPR routes. | 
            
                                                                        
                            
            
                                    
            
            
                | 24 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 25 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 26 |  |  |      */ | 
            
                                                                        
                            
            
                                    
            
            
                | 27 |  |  |     protected function registerRoutes() | 
            
                                                                        
                            
            
                                    
            
            
                | 28 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 29 |  |  |         Route::group([ | 
            
                                                                        
                            
            
                                    
            
            
                | 30 |  |  |             'prefix'     => config('gdpr.uri'), | 
            
                                                                        
                            
            
                                    
            
            
                | 31 |  |  |             'namespace'  => 'Soved\Laravel\Gdpr\Http\Controllers', | 
            
                                                                        
                            
            
                                    
            
            
                | 32 |  |  |             'middleware' => config('gdpr.middleware'), | 
            
                                                                        
                            
            
                                    
            
            
                | 33 |  |  |         ], function () { | 
            
                                                                        
                            
            
                                    
            
            
                | 34 |  |  |             $this->loadRoutesFrom(__DIR__.'/../routes/web.php'); | 
            
                                                                        
                            
            
                                    
            
            
                | 35 |  |  |         }); | 
            
                                                                        
                            
            
                                    
            
            
                | 36 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 37 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 38 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 39 |  |  |      * Register the GDPR commands. | 
            
                                                                        
                            
            
                                    
            
            
                | 40 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 41 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 42 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |     protected function registerCommands() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |         if ($this->app->runningInConsole()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |             $this->commands([ | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 47 |  |  |                 Cleanup::class, | 
            
                                                                        
                            
            
                                    
            
            
                | 48 |  |  |             ]); | 
            
                                                                        
                            
            
                                    
            
            
                | 49 |  |  |         } | 
            
                                                                        
                            
            
                                    
            
            
                | 50 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 52 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 53 |  |  |      * Register the application services. | 
            
                                                                        
                            
            
                                    
            
            
                | 54 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 55 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 56 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |     public function register() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |         $this->configure(); | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 60 |  |  |         $this->offerPublishing(); | 
            
                                                                        
                                                                
            
                                    
            
            
                | 61 |  |  |     } | 
            
                                                                        
                                                                
            
                                    
            
            
                | 62 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 63 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 64 |  |  |      * Setup the configuration for GDPR. | 
            
                                                                        
                            
            
                                    
            
            
                | 65 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 66 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 67 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |     protected function configure() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |         $this->mergeConfigFrom( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             __DIR__.'/../config/gdpr.php', | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 72 |  |  |             'gdpr' | 
            
                                                                        
                            
            
                                    
            
            
                | 73 |  |  |         ); | 
            
                                                                        
                            
            
                                    
            
            
                | 74 |  |  |     } | 
            
                                                                        
                            
            
                                    
            
            
                | 75 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 76 |  |  |     /** | 
            
                                                                        
                            
            
                                    
            
            
                | 77 |  |  |      * Setup the resource publishing groups for GDPR. | 
            
                                                                        
                            
            
                                    
            
            
                | 78 |  |  |      * | 
            
                                                                        
                            
            
                                    
            
            
                | 79 |  |  |      * @return void | 
            
                                                                        
                            
            
                                    
            
            
                | 80 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |     protected function offerPublishing() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |         if ($this->app->runningInConsole()) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |             $this->publishes([ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |                 __DIR__.'/../config/gdpr.php' => config_path('gdpr.php'), | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 86 |  |  |             ], 'gdpr-config'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 89 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 90 |  |  |  |