/home/techb158/ileadtechnology.com/SSM/app
NameSizeModeActions
Console/-0755rm
Events/-0755rm
Exceptions/-0755rm
Exports/-0755rm
Helper/-0755rm
Http/-0755rm
Jobs/-0755rm
Listeners/-0755rm
Models/-0755rm
Notifications/-0755rm
Policies/-0755rm
Providers/-0755rm
Repositories/-0755rm
Traits/-0755rm
.DS_Store143400644editdlrm
User.php41860644editdlrm
UserPreference.php11170644editdlrm
UserPushToken.php8610644editdlrm
Edit: /home/techb158/ileadtechnology.com/SSM/app/User.php (4186B)
'array', 'options' => 'array' ]; /** * Get the identifier that will be stored in the subject claim of the JWT. * * @return mixed */ public function getJWTIdentifier() { return $this->getKey(); } /** * Return a key value array, containing any custom claims to be added to the JWT. * * @return array */ public function getJWTCustomClaims() { return []; } public function student() { return $this->hasOne('App\Models\Student\Student'); } public function parent() { return $this->hasOne('App\Models\Student\StudentParent'); } public function employee() { return $this->hasOne('App\Models\Employee\Employee'); } public function userPreference() { return $this->hasOne('App\UserPreference'); } public function pushTokens() { return $this->hasMany('App\UserPushToken'); } public function getOption(string $option) { return array_get($this->options, $option); } public function getProfile() { if ($this->hasRole(config('system.default_role.student'))) { $profile = $this->Student; } else if ($this->hasRole(config('system.default_role.parent'))) { $profile = $this->Parent; } else { $profile = $this->Employee; } return $profile; } public function getNameAttribute() { $profile = $this->getProfile(); if ($profile->first_guardian_name) { return $profile->first_guardian_name; } return $profile->first_name.' '.$profile->middle_name.' '.$profile->last_name; } public function getNameWithEmailAttribute() { $profile = $this->getProfile(); if ($profile->first_guardian_name) { return $profile->first_guardian_name.' ('.$this->email.')'; } return $profile->first_name.' '.$profile->middle_name.' '.$profile->last_name.' ('.$this->email.')'; } public function scopeFilterByEmail($q, $email = null, $s = 0) { if (! $email) { return $q; } return ($s) ? $q->where('email', '=', $email) : $q->where('email', 'like', '%'.$email.'%'); } public function scopeFilterByUsername($q, $username = null, $s = 0) { if (! $username) { return $q; } return ($s) ? $q->where('username', '=', $username) : $q->where('username', 'like', '%'.$username.'%'); } public function scopeFilterByRoleId($q, $role_id = null) { if (! $role_id) { return $q; } return $q->whereHas('roles', function ($q) use ($role_id) { $q->where('role_id', '=', $role_id); }); } public function scopeFilterByStatus($q, $status = null) { if (! $status) { return $q; } return $q->where('status', '=', $status); } public function scopeCreatedAtDateBetween($q, $dates) { if ((! $dates['start_date'] || ! $dates['end_date']) && $dates['start_date'] <= $dates['end_date']) { return $q; } return $q->where('created_at', '>=', getStartOfDate($dates['start_date']))->where('created_at', '<=', getEndOfDate($dates['end_date'])); } }