Files
ahrommag/app/Models/User.php
2025-11-16 12:43:07 +03:30

77 lines
1.8 KiB
PHP

<?php
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Models\Role;
use App\Models\Address;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
/** @use HasFactory<\Database\Factories\UserFactory> */
use HasFactory, Notifiable;
/**
* The attributes that are mass assignable.
*
* @var list<string>
*/
protected $fillable = [
'phone_number', 'token', 'invite_code', 'mobile_verified_at', 'national_code',
'issue_place', 'confirm_national_code', 'confirm', 'info_status', 'full_confirm',
'is_real', 'joined_from' , 'first_name' , 'last_name' , 'father_name' ,'birth_day' ,
'full_name' , 'picture'
];
// روابط
public function financialInfo()
{
return $this->hasOne(FinancialInfo::class);
}
public function address()
{
return $this->belongsTo(Address::class);
}
public function role()
{
return $this->belongsTo(Role::class);
}
public function scoreUser()
{
return $this->hasOne(ScoreUser::class);
}
public function scoreTransactions()
{
return $this->hasMany(ScoreTransaction::class);
}
/**
* 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',
];
}
}