2018-11-02 11:54:46 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2019-01-19 11:35:21 +01:00
|
|
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
|
|
|
|
|
|
|
class CompanyUser extends Pivot
|
2018-11-02 11:54:46 +01:00
|
|
|
{
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
|
2019-01-15 23:00:25 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be cast to native types.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
|
|
|
'settings' => 'collection',
|
|
|
|
];
|
|
|
|
|
2018-11-02 11:54:46 +01:00
|
|
|
public function account()
|
|
|
|
{
|
|
|
|
return $this->hasOne(Account::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
2019-01-19 11:35:21 +01:00
|
|
|
return $this->hasOne(User::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked');
|
2019-01-07 12:30:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function company()
|
|
|
|
{
|
2019-01-19 11:35:21 +01:00
|
|
|
return $this->hasOne(Company::class)->withPivot('permissions', 'settings', 'is_admin', 'is_owner', 'is_locked');
|
2018-11-02 11:54:46 +01:00
|
|
|
}
|
|
|
|
}
|