/** * testDestroyRecord. * * Delete last car inserted. * * Assert that delete method returns true * * assert that returned getAll array has 4 cars * * Assert that car with id of 5 is not in cars table * * @return [type] [description] */ public function testDestroyRecord() { $deleteCar = Car::destroy(5); $cars = Car::getAll(); $this->assertTrue($deleteCar); $this->assertEquals(4, count($cars)); $this->AssertNotContains(5, $cars); $this->AssertNotContains('Beetle', $cars); }
function deleteCar($id) { $car = Car::destroy($id); echo "done"; }
/** * Remove the specified car from storage. * * @param int $id * @return Response */ public function destroy($id) { Car::destroy($id); return Redirect::route('cars.index'); }
/** * Remove the specified car from storage. * * @param int $id * @return Response */ public function destroy($id) { $userId = Auth::user()->id; $carData = Car::find($id); if ($userId === $carData["user_id"]) { Log::info("userid: {$userId}, car: {$id} Deleted."); $carParking = DB::table('car_parking_lots')->where('car_id', $id); $carParking->delete(); Car::destroy($id); return Redirect::route('cars.index'); } else { return "Access Denied: this is not your car."; } }