![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/domains/pdf-ai.com/public_html/app/Models/ |
<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Notifications\Notifiable;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable implements MustVerifyEmail
{
use HasFactory;
use Notifiable;
use HasRoles;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name',
'job_role',
'company',
'website',
'email',
'workbook',
'password',
'phone_number',
'address',
'city',
'postal_code',
'plan_type',
'country',
'profile_photo_path',
'oauth_id',
'oauth_type',
'last_seen',
'referral_id',
'referred_by',
'referral_payment_method',
'referral_paypal',
'referral_bank_requisites'
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
'google2fa_secret',
];
/**
* The attributes that are not mass assignable.
*
* @var array
*/
protected $guarded = [
'available_words',
'available_words_prepaid',
'total_words',
'available_images',
'available_images_prepaid',
'total_images',
'group',
'plan_id',
'status',
'google2fa_enabled',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
protected $dates = [
'created_at',
'updated_at',
'deleted_at'
];
public function path()
{
return route('admin.users.show', $this);
}
/**
* User can have many support tickets
*/
public function support()
{
return $this->hasMany(SupportTicket::class);
}
/**
* User can have many payments
*/
public function payment()
{
return $this->hasMany(Payment::class);
}
public function subscriber()
{
return $this->hasOne(Subscriber::class);
}
public function hasActiveSubscription()
{
return optional($this->subscriber)->isActive() ?? false;
}
/**
* Interact with the user's first name.
*
* @param string $value
* @return \Illuminate\Database\Eloquent\Casts\Attribute
*/
protected function google2faSecret(): Attribute
{
return new Attribute(
get: fn ($value) => decrypt($value),
set: fn ($value) => encrypt($value),
);
}
}