StocksNew/Modules/Product/app/Repositories/WarehouseRepository.php

47 lines
950 B
PHP
Raw Permalink Normal View History

2024-08-27 12:03:06 +00:00
<?php
namespace Modules\Product\Repositories;
use Modules\Product\Models\Warehouse;
class WarehouseRepository implements WarehouseInterface
{
public function findAll()
{
return Warehouse::when(true, function ($query) {
})->paginate(20);
}
public function getWarehouseById($WarehouseId)
{
return Warehouse::findOrFail($WarehouseId);
}
public function getWarehouseByEmail($email)
{
return Warehouse::where('email', $email)->first();
}
public function delete($WarehouseId)
{
Warehouse::destroy($WarehouseId);
}
public function create($WarehouseDetails)
{
return Warehouse::create($WarehouseDetails);
}
public function update($WarehouseId, array $newDetails)
{
return Warehouse::whereId($WarehouseId)->update($newDetails);
}
public function pluck()
{
return Warehouse::pluck('title', 'id');
}
}