kakitangan harian

This commit is contained in:
Afiq
2021-01-11 08:31:00 +08:00
parent 6cbeee9f86
commit 00842e0a67
10 changed files with 108 additions and 60 deletions
@@ -47,4 +47,37 @@ class KakitanganController extends Controller
return redirect()->route('daftar.kakitangan');
}
public function kakitanganHarian(Request $request){
$auth_user = Auth::user();
$user_cawangan = User::where('cawangan','=',$auth_user['cawangan'])->get();
foreach($user_cawangan as $index=>$user){
if($user['roles'] == 'teller'){
if($user['id'] == $request->penilai){
$role_harian = 'penilai';
}else{
$role_harian = 'teller';
}
}elseif($user['roles'] == 'ppc'){
if($user['id'] == $request->khazanah){
$role_harian = 'khazanah';
}else{
$role_harian = 'ppc';
}
}elseif($user['roles'] == 'pc'){
if($user['id'] == $request->khazanah){
$role_harian = 'khazanah';
}else{
$role_harian = 'pc';
}
}
User::where('id','=',$user['id'])->update(array(
'role_harian' => $role_harian
));
}
return redirect()->route('home');
}
}