title: Laravel delete method: how to delete related files
body: <p>I have some issue with my Laravel 4.2 project.
  I have a <code>Photo</code> model and a <code>Service</code> model with relationship <code>Service hasMany Photos</code>.</p>
  
  <p>Photos (files) are stored in <code>public/upload/</code> directory.
  When I delete photo (method <code>delete()</code> in <code>Photo</code>) the file is removed form the server (code shown below) but when I delete <code>Service</code> (method <code>delete()</code> in <code>Service</code>) database entry for <code>Service</code> and all it's photos (DB records) are removed but files are not even when I trigger <code>$this-&gt;photos()-&gt;delete();</code> </p>
  
  <p>I placed <code>Log::debug('photos-&gt;delete() fired');</code> in <code>Photo-&gt;delete()</code> method and it's fired if I call it directly, and when I try to launch it via <code>Service-&gt;delete()</code> there are no log entries. 
  I have no idea why it acts like this. Can anyone help?</p>
  
  <p>This is my code <code>Service</code>:</p>
  
  <pre><code> public function photos()
   {
      return $this-&gt;hasMany('Photo');
   }
   public function delete()
   { 
      $this-&gt;photos()-&gt;delete();
      parent::delete();
   }
  </code></pre>
  
  <p>And <code>Photo</code>:</p>
  
  <pre><code>public function delete()
  {
      Log::debug('photos-&gt;delete() fired');
      $file = public_path().'/upload/'.$this-&gt;filename;
      if(File::isFile($file)){
         File::delete($file);
      }
      parent::delete();
  }
  </code></pre>