45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
|
|
|
use App\Models\DokSiremun\LogPengajuan;
|
|
use App\Models\Verifikator\LogVerifikasiSk;
|
|
use App\Models\Verifikator\Team;
|
|
use App\Models\Verifikator\TeamUser;
|
|
use App\Models\Verifikator\View\Pegawai;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Spatie\Permission\Traits\HasRoles;
|
|
|
|
class User extends Authenticatable
|
|
{
|
|
use HasFactory, Notifiable, HasRoles;
|
|
|
|
protected $table = 'verifikator.users';
|
|
protected $fillable = ['username', 'nip', 'name', 'email', 'password', 'periode', 'change_password_at_next_login', 'unit_ttd_id'];
|
|
protected $hidden = ['password', 'remember_token'];
|
|
|
|
function teams()
|
|
{
|
|
return $this->belongsToMany(Team::class, TeamUser::class, 'user_id', 'team_id')->withPivot('active', 'id');
|
|
}
|
|
|
|
function logVerifikasiSk()
|
|
{
|
|
return $this->hasMany(LogVerifikasiSk::class, 'verified_by', 'nip');
|
|
}
|
|
|
|
function logs()
|
|
{
|
|
return $this->morphMany(LogPengajuan::class, 'logable');
|
|
}
|
|
|
|
function pegawais()
|
|
{
|
|
return $this->hasManyThrough(Pegawai::class, 'user_id', 'nip', 'id', 'nip');
|
|
}
|
|
}
|