⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
app
/
Models
/
Edit File: User.php
<?php namespace App\Models; use App\Notifications\ResetPassword; use App\Notifications\VerifyEmail; use App\Traits\HasPermissions; use Illuminate\Foundation\Auth\User as Authenticatable; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Notifications\Notifiable; use PHPOpenSourceSaver\JWTAuth\Contracts\JWTSubject; class User extends Authenticatable implements JWTSubject //, MustVerifyEmail { use Notifiable, HasPermissions; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'name', 'email', 'password', 'account_role', 'is_active', ]; /** * The attributes that should be hidden for arrays. * * @var array */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast to native types. * * @var array */ protected $casts = [ 'email_verified_at' => 'datetime', ]; /** * The accessors to append to the model's array form. * * @var array */ protected $appends = [ 'photo_url', ]; /** * Get the profile photo URL attribute. * * @return string */ public function getPhotoUrlAttribute() { return vsprintf('https://www.gravatar.com/avatar/%s.jpg?s=200&d=%s', [ md5(strtolower($this->email)), $this->name ? urlencode("https://ui-avatars.com/api/$this->name") : 'mp', ]); } /** * Get the oauth providers. * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function oauthProviders() { return $this->hasMany(OAuthProvider::class); } /** * Send the password reset notification. * * @param string $token * @return void */ public function sendPasswordResetNotification($token) { $this->notify(new ResetPassword($token)); } /** * Send the email verification notification. * * @return void */ public function sendEmailVerificationNotification() { $this->notify(new VerifyEmail); } /** * @return int */ public function getJWTIdentifier() { return $this->getKey(); } /** * @return array */ public function getJWTCustomClaims() { return []; } /** * @return array */ public function hasRole(...$roles) { return $this()->roles()->whereIn('slug', $roles)->count(); } /** * @return array */ public function roles() { return $this->belongsToMany(Role::class, 'user_role'); } /** * @return array */ public function permissions() { return $this->belongsToMany(Permission::class, 'user_permission'); } /** * Get the Accounts. */ public function cashbookAccounts() { return $this->hasMany(Account::class, 'created_by'); } }
Simpan