<?php

namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable; 
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\CanResetPassword;
use Illuminate\Auth\Passwords\CanResetPassword as CanResetPasswordTrait;

class Pembeli extends Authenticatable implements CanResetPassword
{
    use Notifiable, CanResetPasswordTrait;

    protected $table = 'pembelis';

    protected $fillable = [
        'nama_lengkap', 
        'username', 
        'email',
        'password', 
        'no_hp', 
        'alamat'
    ];

    protected $hidden = [
        'password',
    ];

    public function transaksis()
    {
        return $this->hasMany(Transaksi::class, 'pembeli_id');
    }

    public function pesanMasuk()
    {
        return $this->morphMany(Pesan::class, 'penerima');
    }

    public function pesanTerkirim()
    {
        return $this->morphMany(Pesan::class, 'pengirim');
    }
}