コード例 #1
0
 public function boot()
 {
     require __DIR__ . '/Http/routes.php';
     $this->loadViewsFrom(__DIR__ . '/views', 'tok3-publisher');
     $this->publishes([__DIR__ . '/config/publisher.php' => config_path('tok3-publisher.php')], 'package.php');
     $this->publishes([__DIR__ . '/views' => base_path('resources/views/vendor/tok3-publisher')], 'views');
     $this->publishes([__DIR__ . '/migrations' => $this->app->databasePath() . '/migrations'], 'migrations');
     $this->publishes([__DIR__ . '/seeds' => base_path('database/seeds')], 'views');
     // Model event when deleting page delete all images associated with
     Page::deleting(function ($page) {
         if (count($page->images) > 0) {
             foreach ($page->images as $image) {
                 unlink(\Config::get('tok3-publisher.images_dir', 'images/tok3-publisher/') . $image->name);
             }
         }
     });
 }