<?php
namespace App\Models;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\Permission\Traits\HasRoles;
class User extends Authenticatable
{
use HasFactory, Notifiable, SoftDeletes,HasRoles;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $guarded = [];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function level(){
return $this->belongsTo(Level::class)->withTrashed();
}
public function Opd(){
return $this->belongsTo(Opd::class);
}
public function ProkerSubKegiatan(){
return $this->hasMany(ProkerSubKegiatan::class);
}
public function getTextStatusAttribute(){
return ($this->status == 1) ? '<button type="button" class="btn btn-success btn-sm"> Aktif </button>' : '<button type="button" class="btn btn-danger btn-sm"> Tidak Aktif </button>';
}
}
Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]