47 lines
1.0 KiB
PHP
47 lines
1.0 KiB
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Stock\Repositories;
|
||
|
|
||
|
use Modules\Stock\Models\StockLocation;
|
||
|
|
||
|
class StockLocationRepository implements StockLocationInterface
|
||
|
{
|
||
|
public function findAll()
|
||
|
{
|
||
|
return StockLocation::when(true, function ($query) {
|
||
|
|
||
|
})->paginate(20);
|
||
|
}
|
||
|
|
||
|
public function getStockLocationById($StockLocationId)
|
||
|
{
|
||
|
return StockLocation::findOrFail($StockLocationId);
|
||
|
}
|
||
|
|
||
|
public function getStockLocationByEmail($email)
|
||
|
{
|
||
|
return StockLocation::where('email', $email)->first();
|
||
|
}
|
||
|
|
||
|
public function delete($StockLocationId)
|
||
|
{
|
||
|
StockLocation::destroy($StockLocationId);
|
||
|
}
|
||
|
|
||
|
public function create($StockLocationDetails)
|
||
|
{
|
||
|
return StockLocation::create($StockLocationDetails);
|
||
|
}
|
||
|
|
||
|
public function update($StockLocationId, array $newDetails)
|
||
|
{
|
||
|
return StockLocation::whereId($StockLocationId)->update($newDetails);
|
||
|
}
|
||
|
|
||
|
public function pluck()
|
||
|
{
|
||
|
return StockLocation::pluck('title', 'id');
|
||
|
}
|
||
|
|
||
|
}
|