예제 #1
0
 /**
  * Handle the event.
  *
  * @param  DeletedPost  $event
  * @return void
  */
 public function handle(DeletedNotice $event)
 {
     $path = public_path() . '/images/news';
     $noticePath = $path . '/' . $event->notice->permalink;
     $imageLarge = $event->notice->image_large;
     $imageMedium = $event->notice->image_medium;
     $imageThumbnail = $event->notice->image_thumbnail;
     if (File::exists($noticePath)) {
         // Delete Images
         $this->image->delete($noticePath, $imageLarge);
         $this->image->delete($noticePath, $imageMedium);
         $this->image->delete($noticePath, $imageThumbnail);
         // Check if there is files into category directory
         if ($this->directory->filesEmpty($noticePath)) {
             // Delete post directory
             $this->directory->delete($noticePath);
         }
     }
 }
예제 #2
0
 /**
  * Handle the event.
  *
  * @param  DeletedPost  $event
  * @return void
  */
 public function handle(DeletedPost $event)
 {
     $path = public_path() . '/images/posts';
     $postPath = $path . '/' . $event->post->permalink;
     $imageLarge = $event->post->image;
     $imageMedium = $event->post->image_medium;
     $imageThumbnail = $event->post->image_thumbnail;
     if (File::exists($postPath)) {
         // Delete Images
         $this->image->delete($postPath, $imageLarge);
         $this->image->delete($postPath, $imageMedium);
         $this->image->delete($postPath, $imageThumbnail);
         // Check if there is files into category directory
         // if for some reason can't delete files
         if ($this->directory->filesEmpty($postPath)) {
             // Delete post directory
             $this->directory->delete($postPath);
         }
     }
 }