Exemplo n.º 1
0
 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 protected static function boot()
 {
     parent::boot();
     static::deleting(function (self $attachment) {
         File::delete($attachment->getPath());
     });
 }
Exemplo n.º 2
0
 /**
  * The "booting" method of the model.
  *
  * @return void
  */
 protected static function boot()
 {
     parent::boot();
     static::deleting(function (self $document) {
         $document->load(['attachments'])->getRelation('attachments')->each(function (Attachment $attachment) {
             $attachment->delete();
         });
     });
 }