leave type module setup
This commit is contained in:
12
Modules/Leave/app/Repositories/LeaveTypeInterface.php
Normal file
12
Modules/Leave/app/Repositories/LeaveTypeInterface.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Repositories;
|
||||
|
||||
interface LeaveTypeInterface
|
||||
{
|
||||
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/app/Repositories/LeaveTypeRepository.php
Normal file
34
Modules/Leave/app/Repositories/LeaveTypeRepository.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Leave\Repositories;
|
||||
|
||||
use Modules\Leave\Models\LeaveType;
|
||||
|
||||
class LeaveTypeRepository implements LeaveTypeInterface
|
||||
{
|
||||
public function findAll()
|
||||
{
|
||||
return LeaveType::get();
|
||||
}
|
||||
|
||||
public function getLeaveById($leaveId)
|
||||
{
|
||||
return LeaveType::findOrFail($leaveId);
|
||||
}
|
||||
|
||||
public function delete($leaveId)
|
||||
{
|
||||
LeaveType::destroy($leaveId);
|
||||
}
|
||||
|
||||
public function create(array $leaveDetails)
|
||||
{
|
||||
return LeaveType::create($leaveDetails);
|
||||
}
|
||||
|
||||
public function update($leaveId, array $newDetails)
|
||||
{
|
||||
return LeaveType::where('leave_id', $leaveId)->update($newDetails);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user