// SYSTEM PANEL //
[ROOT]
/
mnt
/
pleskStorage
/
vhosts
/
kodsolutions.net
/
subdomains
/
syaaraa.kodsolutions.net
/
app
/
Models
[ PARENT ]
EDIT :: User.php
<?php namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use App\Helpers\Constants; use Laravel\Sanctum\HasApiTokens; use Spatie\MediaLibrary\HasMedia; use Illuminate\Notifications\Notifiable; use Spatie\MediaLibrary\InteractsWithMedia; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; class User extends Authenticatable implements HasMedia { use HasApiTokens, HasFactory, Notifiable; use InteractsWithMedia; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'name', 'email', 'password', 'phone', 'image', 'full_phone', 'phone_code', 'type', //'owner', 'customer', 'marketer', 'developer', 'office' 'gender', 'active', 'is_verify', 'position', 'national_id', 'verify_mobile', 'package_id', 'package_expired_at' ]; /** * The attributes that should be hidden for serialization. * * @var array<int, string> */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; public function setPasswordAttribute($pass) { $this->attributes['password'] = bcrypt($pass); } public function scopeRecent($query) { return $query->orderBy('id', 'desc'); } public function scopePublish($query) { return $query->where('active', 1); } public function scopeUser($query) { return $query->where('type', Constants::USER_TYPE); } public function scopeOwner($query) { return $query->where('type', Constants::OWNER_TYPE); } public function scopeMarketer($query) { return $query->where('type', Constants::MARKETER_TYPE); } public function scopeDeveloper($query) { return $query->where('type', Constants::DEVELOPER_TYPE); } public function scopeOffice($query) { return $query->where('type', Constants::OFFICE_TYPE); } public function getImagesAttribute() { $images = []; $files = $this->getMedia('document'); if (!empty($files)) { foreach ($files as $file) { array_push($images, $file->getFullUrl()); } } return $images; } }
SAVE
CANCEL