38 lines
686 B
PHP
38 lines
686 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Contact extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'pemilik_kontak',
|
|
'relasi_kontak',
|
|
];
|
|
|
|
protected $casts = [
|
|
'id' => 'string',
|
|
];
|
|
|
|
|
|
//Relasi
|
|
public function pemilikKontak(){
|
|
return $this->belongsTo(User::class, 'pemilik_kontak', 'email');
|
|
}
|
|
|
|
public function relasiKontak(){
|
|
return $this->belongsTo(User::class, 'relasi_kontak', 'email');
|
|
}
|
|
|
|
//Relasi
|
|
}
|