Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 19 |
| compOffLeaveBalanceRequestController | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 19 |
| index | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 19 |
|||
| <?php | |
| namespace App\Http\Controllers\Leave; | |
| use App\Http\Controllers\Controller; | |
| use Illuminate\Http\Request; | |
| use App\Models\Admin\Leave; | |
| use App\Models\Leave\CompOffLeave; | |
| use App\Models\Leave\RejectedCompOffLeave; | |
| use App\Helpers\GetShiftDetailHelper; | |
| use Illuminate\Support\Facades\DB; | |
| use App\Helpers\AttendanceHelper; | |
| class compOffLeaveBalanceRequestController extends Controller | |
| { | |
| public function index(Request $request) | |
| { | |
| $title = '/Leave/CompOff Leave Balance Requests'; | |
| $backUrl = route('home'); | |
| $appliedleave = []; | |
| $userId = GetShiftDetailHelper::getMyReport(); | |
| // $Appliedleave= ApplyLeave::select('created_at', 'from_date', 'to_date', 'leave_length', 'reason', 'status') | |
| // ->whereIn('status',['Approve', 'Cancel', 'Pending','Reject']) | |
| // ->where('user_id', $userId); | |
| $appliedLeave = DB::table('comp_off_leaves') | |
| ->select(DB::raw("'comp_off_leaves' as 'table_name'"), 'id', 'user_id', 'created_at', 'date','is_process','is_future', 'reason', 'status') | |
| ->whereIn('status', ['Approve', 'Cancel', 'Pending', 'Reject']) | |
| ->where('user_id', $userId); | |
| $rejectedLeaves = DB::table('comp_off_rejected_leaves') | |
| ->select(DB::raw("'comp_off_rejected_leaves' as 'table_name'"), 'id', 'user_id', 'created_at', 'date', 'is_process', 'is_future', 'reason', 'status') | |
| ->where('status', 'Reject') | |
| ->where('user_id', $userId); | |
| $allLeaves = $appliedLeave->union($rejectedLeaves) | |
| ->orderBy('created_at', 'DESC') | |
| ->get(); | |
| // For returning attendance marking for home controller | |
| $val = AttendanceHelper::getAttendanceMarkValue(); | |
| $valTeam = AttendanceHelper::getAttendanceTeam($request); | |
| $valUser = AttendanceHelper::getAttendanceUser($request); | |
| return view('leave.compOffLeaveBalanceRequest', compact('title', 'allLeaves','val','valTeam','valUser')); | |
| } | |
| } |