Exemple #1
0
 public function removeImageById($id)
 {
     if (Auth::check()) {
         $image = AdImage::whereId($id)->with('ad')->first();
         if (null !== $image && $image->ad->author_id == Auth::user()->id) {
             return AdImage::remove($id);
         }
     }
     return 0;
 }
Exemple #2
0
 public static function remove($id)
 {
     $image = AdImage::whereId($id)->first();
     $image->delete();
     return 1;
 }