Files
lelong/app/Models/User.php
T

82 lines
1.7 KiB
PHP

<?php
namespace App\Models;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Traits\HasRoles;
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Notifications\PasswordResetNotification;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use HasApiTokens, HasFactory, Notifiable, HasRoles;
/**
* The attributes that are mass assignable.
*
* @var string[]
*/
protected $fillable = [
'name',
'username',
'email',
'password',
'token',
'is_verified',
'kodcaw',
'nokp',
'bank_acc_pembeli',
'bank_acc_no_pembeli',
'alamat',
'notelpejabat',
'notelbimbit',
'note',
'status',
't_daftar',
'online',
'register_agree',
'disahkan_pada',
'disahkan_oleh'
];
/**
* The attributes that should be hidden for serialization.
*
* @var array
*/
protected $hidden = [
'password',
'remember_token',
];
/**
* The attributes that should be cast.
*
* @var array
*/
protected $casts = [
'email_verified_at' => 'datetime',
];
public function sendPasswordResetNotification($token)
{
$this->notify(new PasswordResetNotification($token));
// $user->notify(new PasswordResetNotification($user));
}
public function cawangan()
{
return $this->hasOne(Cawangan::class, 'caw_code' , 'kodcaw');
}
public function payment()
{
return $this->hasMany(Payment::class, 'user_id', 'id');
}
}