diff --git a/app/Providers/RepositoryServiceProvider.php b/app/Providers/RepositoryServiceProvider.php new file mode 100644 index 0000000..82e82a5 --- /dev/null +++ b/app/Providers/RepositoryServiceProvider.php @@ -0,0 +1,35 @@ +app->bind(UserRepositoryInterface::class, UserRepository::class); + $this->app->bind(DeliveryRepositoryInterface::class, DeliveryRepository::class); + $this->app->bind(CarRepositoryInterface::class, CarRepository::class); + $this->app->bind(WarehouseRepositoryInterface::class, WarehouseRepository::class); + } + + /** + * Bootstrap services. + */ + public function boot(): void + { + // + } +} diff --git a/app/Repositories/Interfaces/CarRepositoryInterface.php b/app/Repositories/Interfaces/CarRepositoryInterface.php new file mode 100644 index 0000000..4bc0315 --- /dev/null +++ b/app/Repositories/Interfaces/CarRepositoryInterface.php @@ -0,0 +1,13 @@ +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(); + } +} diff --git a/app/Repositories/SQL/DeliveryRepository.php b/app/Repositories/SQL/DeliveryRepository.php new file mode 100644 index 0000000..32b99f0 --- /dev/null +++ b/app/Repositories/SQL/DeliveryRepository.php @@ -0,0 +1,30 @@ +get(); + } + + public function createDelivery(array $data) + { + Delivery::create($data); + } + + public function updateDelivery(Delivery $delivery, array $data) + { + $delivery->update($data); + } + + public function deleteDelivery(Delivery $delivery) + { + $delivery->delete(); + } +} diff --git a/app/Repositories/SQL/UserRepository.php b/app/Repositories/SQL/UserRepository.php new file mode 100644 index 0000000..5ee5888 --- /dev/null +++ b/app/Repositories/SQL/UserRepository.php @@ -0,0 +1,29 @@ +get(); + } + + public function createUser(array $data) + { + User::create($data); + } + + public function updateUser(User $user, array $data) + { + $user->update($data); + } + + public function deleteUser(User $user) + { + $user->delete(); + } +} diff --git a/app/Repositories/SQL/WarehouseRepository.php b/app/Repositories/SQL/WarehouseRepository.php new file mode 100644 index 0000000..52bff9c --- /dev/null +++ b/app/Repositories/SQL/WarehouseRepository.php @@ -0,0 +1,29 @@ +get(); + } + + public function createWarehouse(array $data) + { + Warehouse::create($data); + } + + public function updateWarehouse(Warehouse $warehouse, array $data) + { + $warehouse->update($data); + } + + public function deleteWarehouse(Warehouse $warehouse) + { + $warehouse->delete(); + } +} diff --git a/config/app.php b/config/app.php index 9207160..ac864d1 100644 --- a/config/app.php +++ b/config/app.php @@ -168,6 +168,7 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, + App\Providers\RepositoryServiceProvider::class, ])->toArray(), /*