Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 39 |
| AttendanceHelper | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
182 | |
0.00% |
0 / 39 |
| getAttendanceMarkValue | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 7 |
|||
| getAttendanceTeam | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 16 |
|||
| getAttendanceUser | |
0.00% |
0 / 1 |
30 | |
0.00% |
0 / 16 |
|||
| <?php | |
| namespace App\Helpers; | |
| use App\Models\Admin\Setting; | |
| use App\Models\Admin\Team; | |
| use App\Models\Auth\User; | |
| use App\Models\Admin\TeamSetting; | |
| use App\Models\Admin\userSetting; | |
| use App\Models\Admin\TeamUserDetail; | |
| use Illuminate\Http\Request; | |
| use Illuminate\Support\Facades\Auth; | |
| use Gate; | |
| class AttendanceHelper{ | |
| // Global function for Attendance mark value for oraganisation level | |
| public static function getAttendanceMarkValue() { | |
| if (Gate::check('Super Admin')) { | |
| $val = null; | |
| } else { | |
| $attendanceMarkvalue = Setting::where('name','=','attendance')->where('category','=','general')->first(); | |
| if ($attendanceMarkvalue) { | |
| $val = $attendanceMarkvalue->value; | |
| } else { | |
| $val = null; | |
| } | |
| } | |
| return $val; | |
| } | |
| // Global function for Attendance mark value for team level | |
| public static function getAttendanceTeam($id,$bit=1){ | |
| if (Gate::check('Super Admin')) { | |
| $valTeam = null; | |
| return $valTeam; | |
| } | |
| $parameter = $id; | |
| if($bit==1){ | |
| $parameter = $id->user()->userdetail->primary_team_id; | |
| } | |
| if (Gate::check('Super Admin')) { | |
| $valTeam = null; | |
| } else { | |
| $attendanceMarkTeam = TeamSetting::where('name','attendance') | |
| ->where('category','Team') | |
| ->where('team_id',$parameter) | |
| ->first(); | |
| // dd($attendanceMarkTeam->value); | |
| if ($attendanceMarkTeam) { | |
| $valTeam = $attendanceMarkTeam->value; | |
| } else { | |
| $valTeam = null; | |
| } | |
| } | |
| return $valTeam; | |
| } | |
| // Global function for Attendance mark value for user level | |
| public static function getAttendanceUser($id,$bit=1){ | |
| if (Gate::check('Super Admin')) { | |
| $valUser = null; | |
| return $valUser; | |
| } | |
| $user_id = $id; | |
| if($bit==1){ | |
| $user_id = $id->user()->id; | |
| } | |
| if (Gate::check('Super Admin')) { | |
| $valUser = null; | |
| } else { | |
| $attendanceMarkUser = userSetting::where('name','attendance') | |
| ->where('category','User') | |
| ->where('user_id',$user_id) | |
| ->first(); | |
| if ($attendanceMarkUser) { | |
| $valUser = $attendanceMarkUser->value; | |
| } else { | |
| $valUser = null; | |
| } | |
| } | |
| return $valUser; | |
| } | |
| } | |
| ?> |