2
2
3
3
namespace App \Models ;
4
4
5
- use App \Models \User ;
6
5
use Illuminate \Database \Eloquent \Factories \HasFactory ;
7
6
use Illuminate \Database \Eloquent \Model ;
8
7
use Illuminate \Support \Facades \Auth ;
@@ -25,46 +24,46 @@ protected static function booted(): void
25
24
static ::creating (function (IzinKeluar $ izin ) {
26
25
$ izin ->user_id = Auth::user ()->id ;
27
26
$ izin ->tahun = session ('year ' );
28
-
29
27
});
30
28
static ::created (function (IzinKeluar $ izin ) {
31
29
$ usercache = User::cache ()->get ('all ' );
32
30
if (Auth::user ()->role === 'kepala ' ) {
33
31
$ users = $ usercache ->where ('role ' , 'koordinator ' );
34
- foreach ($ users as $ user )
35
- $ user ->notify (
36
- NovaNotification::make ()
37
- ->message ('Izin Keluar Baru: ' .Auth::user ()->nama .' Mengajukan Izin Keluar untuk ' .$ izin ->kegiatan )
38
- ->action ('Lihat ' , URL ::remote (Nova::path () . "/resources/ " .\App \Nova \IzinKeluar::uriKey ()."/ " .$ izin ->id ))
39
- ->icon ('information-circle ' )
40
- ->type ('info ' )
41
- );
32
+ foreach ($ users as $ user ) {
33
+ $ user ->notify (
34
+ NovaNotification::make ()
35
+ ->message ('Izin Keluar Baru: ' .Auth::user ()->nama .' Mengajukan Izin Keluar untuk ' .$ izin ->kegiatan )
36
+ ->action ('Lihat ' , URL ::remote (Nova::path ().'/resources/ ' .\App \Nova \IzinKeluar::uriKey ().'/ ' .$ izin ->id ))
37
+ ->icon ('information-circle ' )
38
+ ->type ('info ' )
39
+ );
40
+ }
42
41
}
43
42
if (Auth::user ()->role === 'koordinator ' ) {
44
43
$ users = $ usercache ->where ('role ' , 'kepala ' );
45
- foreach ($ users as $ user )
46
- $ user ->notify (
47
- NovaNotification::make ()
48
- ->message ('Izin Keluar Baru: ' .Auth::user ()->nama .' Mengajukan Izin Keluar untuk ' .$ izin ->kegiatan )
49
- ->action ('Lihat ' , URL ::remote (Nova::path () . "/resources/ " .\App \Nova \IzinKeluar::uriKey ()."/ " .$ izin ->id ))
50
- ->icon ('information-circle ' )
51
- ->type ('info ' )
52
- );
44
+ foreach ($ users as $ user ) {
45
+ $ user ->notify (
46
+ NovaNotification::make ()
47
+ ->message ('Izin Keluar Baru: ' .Auth::user ()->nama .' Mengajukan Izin Keluar untuk ' .$ izin ->kegiatan )
48
+ ->action ('Lihat ' , URL ::remote (Nova::path ().'/resources/ ' .\App \Nova \IzinKeluar::uriKey ().'/ ' .$ izin ->id ))
49
+ ->icon ('information-circle ' )
50
+ ->type ('info ' )
51
+ );
52
+ }
53
53
}
54
54
if (Auth::user ()->role === 'anggota ' ) {
55
55
$ users = $ usercache ->where ('role ' , 'koordinator ' )
56
- ->where ('unit_kerja_id ' , Auth::user ()->unit_kerja_id );
57
- foreach ($ users as $ user )
58
- $ user ->notify (
59
- NovaNotification::make ()
60
- ->message ('Izin Keluar Baru: ' .Auth::user ()->nama .' Mengajukan Izin Keluar untuk ' .$ izin ->kegiatan )
61
- ->action ('Lihat ' , URL ::remote (Nova::path () . "/resources/ " .\App \Nova \IzinKeluar::uriKey ()."/ " .$ izin ->id ))
62
- ->icon ('information-circle ' )
63
- ->type ('info ' )
64
- );
56
+ ->where ('unit_kerja_id ' , Auth::user ()->unit_kerja_id );
57
+ foreach ($ users as $ user ) {
58
+ $ user ->notify (
59
+ NovaNotification::make ()
60
+ ->message ('Izin Keluar Baru: ' .Auth::user ()->nama .' Mengajukan Izin Keluar untuk ' .$ izin ->kegiatan )
61
+ ->action ('Lihat ' , URL ::remote (Nova::path ().'/resources/ ' .\App \Nova \IzinKeluar::uriKey ().'/ ' .$ izin ->id ))
62
+ ->icon ('information-circle ' )
63
+ ->type ('info ' )
64
+ );
65
+ }
65
66
}
66
-
67
67
});
68
-
69
68
}
70
69
}
0 commit comments