1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00
invoiceninja/app/Models/CompanyUser.php
David Bomba feafbd9826
User Settings (#2601)
* Datamapping JSON Settings

*  JSON Mapping

* User Setting Defaults

* Testing Json Mapper

* Implemented User Settings - hydrated from JSON format
2019-01-16 09:00:25 +11:00

34 lines
607 B
PHP

<?php
namespace App\Models;
class CompanyUser extends BaseModel
{
protected $guarded = ['id'];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'settings' => 'collection',
];
public function account()
{
return $this->hasOne(Account::class);
}
public function user()
{
return $this->hasOne(User::class)->withPivot('permissions', 'settings');
}
public function company()
{
return $this->hasOne(Company::class)->withPivot('permissions', 'settings');
}
}