本文整理汇总了PHP中Car::all方法的典型用法代码示例。如果您正苦于以下问题:PHP Car::all方法的具体用法?PHP Car::all怎么用?PHP Car::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Car
的用法示例。
在下文中一共展示了Car::all方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
$faker = Faker::create();
$parking_lot = ParkingLot::all()->random();
$car = Car::all()->random();
$order = new Order();
$order->parking_lot_id = $parking_lot->id;
$order->car_id = $car->id;
$order->stripe_customer_id = $faker->swiftBicNumber;
$order->save();
$parking_lot = ParkingLot::all()->random();
$car = Car::all()->random();
$order2 = new Order();
$order2->parking_lot_id = $parking_lot->id;
$order2->car_id = $car->id;
$order2->stripe_customer_id = $faker->swiftBicNumber;
$order2->save();
$parking_lot = ParkingLot::all()->random();
$car = Car::all()->random();
$order3 = new Order();
$order3->parking_lot_id = $parking_lot->id;
$order3->car_id = $car->id;
$order3->stripe_customer_id = $faker->swiftBicNumber;
$order3->save();
}
示例2: edit
/**
* Show the form for editing the specified booking.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$booking = Booking::find($id);
$clients = Client::all();
$cars = Car::all();
return View::make('bookings.edit', compact('booking', 'cars', 'clients'));
}
示例3: getAll
public function getAll()
{
$obj = new Car($this->db);
echo json_encode($obj->all());
}
示例4: index
/**
* Display a listing of cars
*
* @return Response
*/
public function index()
{
$cars = Car::all();
return View::make('cars.index', compact('cars'));
}
示例5: getUserById
});
/* CAR START */
$app->get("/user/:id", "getUserById");
function getUserById($id)
{
$user = User::find($id);
echo $user;
}
$app->get("/car/:id", "getCarById");
function getCarById($id)
{
$car = Car::find($id);
echo $car;
}
$app->get("/cars", function () {
$cars = Car::all();
echo $cars;
});
$app->delete("/cars/:id", "deleteCar");
function deleteCar($id)
{
$car = Car::destroy($id);
echo "done";
}
$app->post("/car", "createCar");
function createCar()
{
$request = Slim\Slim::getInstance()->request();
$car = json_decode($request->getBody());
$car = Car::create(['users_idU' => 1, 'modelC' => $car->modelC, 'brandC' => $car->brandC, 'registrationC' => $car->registrationC]);
echo $car;
示例6: Car
<?php
require 'Wheel.php';
require 'Engine.php';
require 'Car.php';
$car = new Car();
//$car->startAndStop();
//$car->rollAndDrift();
$car->all();