restaurant changes
This commit is contained in:
46
Modules/Ingredient/app/Repositories/UnitRepository.php
Normal file
46
Modules/Ingredient/app/Repositories/UnitRepository.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Ingredient\Repositories;
|
||||
|
||||
use Modules\Ingredient\Models\Unit;
|
||||
|
||||
class UnitRepository implements UnitInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return Unit::when(true, function ($query) {
|
||||
|
||||
})->paginate(20);
|
||||
}
|
||||
|
||||
public function getUnitById($UnitId)
|
||||
{
|
||||
return Unit::findOrFail($UnitId);
|
||||
}
|
||||
|
||||
public function getUnitByEmail($email)
|
||||
{
|
||||
return Unit::where('email', $email)->first();
|
||||
}
|
||||
|
||||
public function delete($UnitId)
|
||||
{
|
||||
Unit::destroy($UnitId);
|
||||
}
|
||||
|
||||
public function create($UnitDetails)
|
||||
{
|
||||
return Unit::create($UnitDetails);
|
||||
}
|
||||
|
||||
public function update($UnitId, array $newDetails)
|
||||
{
|
||||
return Unit::whereId($UnitId)->update($newDetails);
|
||||
}
|
||||
|
||||
public function pluck()
|
||||
{
|
||||
return Unit::pluck('title', 'id');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user