public function delete() { // Delete all of the products that have the same ids... QltyDataDetail::where("QLTY_DATA_ID", $this->primaryKey)->delete(); // Finally, delete this category... return parent::delete(); }