1 | <?php |
||
2 | |||
3 | namespace App; |
||
4 | |||
5 | use Carbon\Carbon; |
||
6 | use Illuminate\Notifications\Notifiable; |
||
7 | use Illuminate\Contracts\Auth\MustVerifyEmail; |
||
8 | use Illuminate\Foundation\Auth\User as Authenticatable; |
||
9 | |||
10 | class Admin extends Authenticatable |
||
11 | { |
||
12 | use Notifiable; |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
13 | |||
14 | protected $guard = 'admin'; |
||
15 | |||
16 | |||
17 | /** |
||
18 | * The attributes that are mass assignable. |
||
19 | * |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $fillable = [ |
||
23 | 'name', 'profile_picture', 'email', 'password', |
||
24 | ]; |
||
25 | |||
26 | |||
27 | /** |
||
28 | * The attributes that should be hidden for arrays. |
||
29 | * |
||
30 | * @var array |
||
31 | */ |
||
32 | protected $hidden = [ |
||
33 | 'password', 'remember_token', |
||
34 | ]; |
||
35 | |||
36 | |||
37 | /** |
||
38 | * The attributes that should be cast to native types. |
||
39 | * |
||
40 | * @var array |
||
41 | */ |
||
42 | protected $casts = [ |
||
43 | 'email_verified_at' => 'datetime', |
||
44 | ]; |
||
45 | |||
46 | |||
47 | /** |
||
48 | * @var array |
||
49 | */ |
||
50 | protected $dates = [ |
||
51 | 'created_at', |
||
52 | 'updated_at' |
||
53 | ]; |
||
54 | |||
55 | |||
56 | /** |
||
57 | * @return \Illuminate\Database\Eloquent\Relations\HasMany |
||
58 | */ |
||
59 | public function article() |
||
60 | { |
||
61 | return $this->hasMany('App\Articles'); |
||
62 | } |
||
63 | |||
64 | |||
65 | /** |
||
66 | * @return string |
||
67 | */ |
||
68 | public function getGreetings() |
||
69 | { |
||
70 | $h = Carbon::now()->format('H'); |
||
71 | |||
72 | if ($h >= 0 && $h < 6) { |
||
73 | return "<i class='fa far fa-surprise fa-2x'></i> Wow, ini masih pagi loh "; |
||
74 | } elseif ($h >= 6 && $h < 11) { |
||
75 | return "<i class='fa far fa-laugh-beam fa-2x'></i> Selamat pagi "; |
||
76 | } elseif ($h >= 11 && $h <= 14) { |
||
77 | return "<i class='fa far fa-smile-wink fa-2x'></i> Selamat siang "; |
||
78 | } elseif ($h > 14 && $h <= 16) { |
||
79 | return "<i class='fa far fa-smile-beam fa-2x'></i> Selamat sore "; |
||
80 | } elseif ($h >= 17 && $h < 20) { |
||
81 | return "<i class='fa far fa-grin-stars fa-2x'></i> Senja yang indah ya "; |
||
82 | } else { |
||
83 | return "<i class='fa far fa-bed fa-2x'></i> Sudah malam, sebaiknya kamu istirahat "; |
||
84 | } |
||
85 | } |
||
86 | } |
||
87 |