本文整理汇总了PHP中Car::destroy方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::destroy方法的具体用法?PHP Car::destroy怎么用?PHP Car::destroy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::destroy方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDestroyRecord
/**
* 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);
}
示例2: deleteCar
function deleteCar($id)
{
$car = Car::destroy($id);
echo "done";
}
示例3: destroy
/**
* Remove the specified car from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id)
{
Car::destroy($id);
return Redirect::route('cars.index');
}
示例4: destroy
/**
* 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.";
}
}