Files
monica/app/Models/Relationship/Relationship.php
T
Régis FreydandGitHub 29197090a7 Restructure where models are stored (#1476)
The idea is to clean the repository a little bit by moving models into their respective folders.
2018-06-14 20:49:12 -04:00

46 lines
911 B
PHP

<?php
namespace App\Models\Relationship;
use App\Models\Account\Account;
use App\Models\Contact\Contact;
use Illuminate\Database\Eloquent\Model;
/**
* A relationship defines relations between contacts.
*/
class Relationship extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'account_id',
'contact_is',
'of_contact',
'relationship_type_id',
];
public function account()
{
return $this->belongsTo(Account::class);
}
public function contactIs()
{
return $this->belongsTo(Contact::class, 'contact_is');
}
public function ofContact()
{
return $this->belongsTo(Contact::class, 'of_contact');
}
public function relationshipType()
{
return $this->belongsTo(RelationshipType::class, 'relationship_type_id');
}
}