/
home
/
maktab
/
server
/
app
/
Models
/
File Upload :
llllll
Current File: /home/maktab/server/app/Models/User.php
<?php namespace App\Models; use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Support\Facades\Hash; use Tymon\JWTAuth\Contracts\JWTSubject; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; use App\Models\user_info; class User extends Authenticatable implements JWTSubject { use HasApiTokens, HasFactory, Notifiable,SoftDeletes,Selector; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'fname', 'lname', 'name', 'token', 'mobile', 'password', 'last_seen_at', 'file_id', 'user_type', 'active', 'maktab_id',//for employee 'type_employee', 'type', 'birth_day' ]; /** * The attributes that should be hidden for serialization. * * @var array<int, string> */ protected $hidden = [ 'password', ]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts=[ 'active'=>'boolean' ]; static $TYPE =[ //مدیر پنل ادمین 1 => 'مدیران', //پدر 2 => 'مدیر خانواده', //مدیر 3 => 'مدیر مکتب', //عوامل 4 => 'عوامل', //سوپروایزر 5 => 'سوپروایزر', 6 => 'مهمان', ]; /* * user access * 1 = all * 2->getColony->getMaktab->getUser * 3->getMaktab->getUser * 4-if cinst->id = teacher->getStudent * else false * 5 = all * */ public function getJWTIdentifier() { return $this->getKey(); } public function getJWTCustomClaims() { return []; } // hash password public function setPasswordAttribute($value){ $this->attributes['password'] = Hash::make($value); } public function userTypeCnt() { return $this->belongsTo(Cnt::class,'user_type'); } public function file() { return $this->belongsTo(File::class); } //for employee public function maktab() { return $this->belongsTo(Maktab::class); } public function type_cnt() { return $this->belongsTo(Cnt::class,'type_employee'); } public function attendance() { return $this->hasOne(Attendance::class,'employee_id'); } public function attendances() { return $this->hasMany(Attendance::class,'employee_id'); } public function experiences() { return $this->hasMany(Experience::class,'user_id'); } public function cloony() { return $this->hasOne(Cloony::class,'master_id'); } public function userInfo() { return $this->hasOne(user_info::class,'user_id'); } public function message() { return $this->hasMany(Message::class,'send_user_id'); } public function Users_to_maktab() { return $this->hasMany(Users_to_maktab::class, 'user_id', 'id'); } public function children() { return $this->hasMany(Children::class,'user_id'); } }
Copyright ©2k19 -
Hexid
|
Tex7ure