leave module setup
This commit is contained in:
0
Modules/Leave/Repositories/.gitkeep
Normal file
0
Modules/Leave/Repositories/.gitkeep
Normal file
12
Modules/Leave/Repositories/LeaveInterface.php
Normal file
12
Modules/Leave/Repositories/LeaveInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Repositories;
|
||||
|
||||
interface LeaveInterface
|
||||
{
|
||||
public function findAll();
|
||||
public function getLeaveById($leaveId);
|
||||
public function delete($leaveId);
|
||||
public function create(array $LeaveDetails);
|
||||
public function update($leaveId, array $newDetails);
|
||||
}
|
34
Modules/Leave/Repositories/LeaveRepository.php
Normal file
34
Modules/Leave/Repositories/LeaveRepository.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?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);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user