46 lines
981 B
PHP
46 lines
981 B
PHP
<?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 Petani extends Authenticatable implements CanResetPassword
|
|
{
|
|
use Notifiable, CanResetPasswordTrait;
|
|
|
|
protected $table = 'petanis';
|
|
|
|
protected $fillable = [
|
|
'nik',
|
|
'nama_lengkap',
|
|
'username',
|
|
'email',
|
|
'password',
|
|
'no_hp',
|
|
'alamat',
|
|
'nama_usaha',
|
|
'status_akun'
|
|
];
|
|
|
|
protected $hidden = [
|
|
'password',
|
|
];
|
|
|
|
public function produks()
|
|
{
|
|
return $this->hasMany(Produk::class, 'petani_id');
|
|
}
|
|
|
|
public function pesanMasuk()
|
|
{
|
|
return $this->morphMany(Pesan::class, 'penerima');
|
|
}
|
|
|
|
public function pesanTerkirim()
|
|
{
|
|
return $this->morphMany(Pesan::class, 'pengirim');
|
|
}
|
|
} |