47 lines
856 B
PHP
Raw Normal View History

2024-09-19 18:33:08 +05:45
<?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');
}
}