public function testDestroy() { $this->testCreateNew(); //Create new first $product = Product::find('1'); $product->delete(); $result = Product::find('1'); $this->assertTrue($result == null); }
public function getDelete($id) { // Find the product using the user id $product = Product::find($id); if ($product == null) { $errors = new \Illuminate\Support\MessageBag(); $errors->add('deleteError', "We are having problem deleting this entry. Please try again."); return \Redirect::to('admin/products')->withErrors($errors); } // Delete all images first $product->deleteAllImages(); // Delete all tags $product->deleteAllTags(); // Delete the product $product->delete(); return Redirect::to('admin/products'); }