Commit 3e05301c authored by King Alex's avatar King Alex

maj

parent 5e5071c0
......@@ -28,4 +28,16 @@ class Recipe extends Eloquent {
{
return $this->belongsToMany('Category', 'recipe_categories');
}
public static function boot()
{
parent::boot();
// cause a delete of a product to cascade to children so they are also deleted
static::deleted(function($recipe)
{
$recipe->images()->delete();
$recipe->ingredients()->delete();
});
}
}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment