31 lines
517 B
PHP
31 lines
517 B
PHP
|
<?php
|
||
|
|
||
|
namespace App\Repositories\SQL;
|
||
|
|
||
|
use App\Models\Car;
|
||
|
use App\Repositories\Interfaces\CarRepositoryInterface;
|
||
|
|
||
|
class CarRepository implements CarRepositoryInterface
|
||
|
{
|
||
|
|
||
|
public function getAllCars()
|
||
|
{
|
||
|
return Car::paginate(5)->get();
|
||
|
}
|
||
|
|
||
|
public function createCar(array $data)
|
||
|
{
|
||
|
Car::create($data);
|
||
|
}
|
||
|
|
||
|
public function updateCar(Car $car, array $data)
|
||
|
{
|
||
|
$car->update($data);
|
||
|
}
|
||
|
|
||
|
public function deleteCar(Car $car)
|
||
|
{
|
||
|
$car->delete();
|
||
|
}
|
||
|
}
|