One Hat Cyber Team
Your IP :
216.73.217.146
Server IP :
50.6.229.107
Server :
Linux server.hostburly.com 5.14.0-611.38.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Mar 10 17:21:28 EDT 2026 x86_64
Server Software :
Apache
PHP Version :
8.2.30
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
andjemzt
/
ggh_api
/
app
/
Models
/
View File Name :
User.php
<?php namespace App\Models; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Spatie\Permission\Traits\HasRoles; use Laravel\Sanctum\HasApiTokens; use Illuminate\Database\Eloquent\Concerns\HasUuids; class User extends Authenticatable implements MustVerifyEmail { /** @use HasFactory<\Database\Factories\UserFactory> */ use HasFactory, Notifiable, HasApiTokens, HasRoles , HasUuids; public $incrementing = false; protected $keyType = 'string'; protected $guard_name = 'api'; /** * The attributes that are mass assignable. * * @var list<string> */ protected $fillable = [ 'name', 'email', 'password', 'stage', 'essential_completed_at', ]; /** * The attributes that should be hidden for serialization. * * @var list<string> */ protected $hidden = [ 'password', 'remember_token', ]; /** * Get the attributes that should be cast. * * @return array<string, string> */ protected function casts(): array { return [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } public function kyc() { return $this->hasOne(\App\Models\Kyc::class); } // public function kycDocuments() // { // // convenient access to docs via kyc // return $this->hasManyThrough( // KycDocument::class, // Kyc::class, // 'user_id', // FK on kycs table // 'kyc_id', // FK on kyc_documents table // 'id', // local key on users // 'id' // local key on kycs // ); // } public function kycDocuments() { return $this->hasManyThrough( \App\Models\KycDocument::class, \App\Models\Kyc::class, 'user_id', 'kyc_id', 'id', 'id' ); } // LMS enrollments (course progress) public function enrollments() { return $this->hasMany(\App\Models\Lms\Enrollment::class, 'user_id'); } // As tutor: courses assigned to tutor public function tutoredCourses() { return $this->belongsToMany(\App\Models\Lms\Course::class, 'course_tutors', 'tutor_id', 'course_id') ->withTimestamps() ->withPivot(['role']); } // As tutor: lessons owned public function ownedLessons() { return $this->hasMany(\App\Models\Lms\Lesson::class, 'owner_tutor_id'); } public function entitlements() { return $this->hasMany(\App\Models\Entitlement::class); } public function essentialEntitlement() { return $this->hasOne(\App\Models\Entitlement::class) ->where('type', 'essential_bundle'); } public function organizations() { return $this->belongsToMany(\App\Models\Organization::class, 'organization_users') ->withPivot(['id','role','status','joined_at']) ->withTimestamps(); } /** * Organizations where the user is the owner (Creator). */ public function ownedOrganizations() { return $this->hasMany(\App\Models\Organization::class, 'created_by'); } /** * Organizations where the user is a member (via pivot), * excluding those they own/created. */ public function memberOrganizations() { return $this->organizations() ->where('created_by', '!=', $this->id); } }