47 lines
950 B
PHP
47 lines
950 B
PHP
|
<?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');
|
||
|
}
|
||
|
|
||
|
}
|