35 lines
624 B
PHP
35 lines
624 B
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Leave\Repositories;
|
||
|
|
||
|
use Modules\Leave\Models\Leave;
|
||
|
|
||
|
class LeaveRepository implements LeaveInterface
|
||
|
{
|
||
|
public function findAll()
|
||
|
{
|
||
|
return Leave::all();
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
}
|
||
|
|
||
|
}
|