New-OMIS/Modules/Leave/Repositories/LeaveRepository.php

35 lines
624 B
PHP
Raw Normal View History

2024-04-04 10:35:27 +00:00
<?php
namespace Modules\Leave\Repositories;
use Modules\Leave\Models\Leave;
class LeaveRepository implements LeaveInterface
{
public function findAll()
{
2024-04-04 12:08:23 +00:00
return Leave::get();
2024-04-04 10:35:27 +00:00
}
public function getLeaveById($leaveId)
{
return Leave::findOrFail($leaveId);
}
public function delete($leaveId)
{
Leave::destroy($leaveId);
}
public function create(array $leaveDetails)
{
return Leave::create($leaveDetails);
}
public function update($leaveId, array $newDetails)
{
return Leave::whereId($leaveId)->update($newDetails);
}
}