class Category extends Eloquent
{
public function products()
{
return $this->has_many('Product');
}
protected static function boot() {
parent::boot();
static::deleting(function($Category) {
$Category->products()->delete();
});
}
}