invoiceninja/app/Models/CompanyToken.php

57 lines
1.1 KiB
PHP
Raw Normal View History

2019-03-26 15:46:08 +11:00
<?php
2019-05-11 13:32:07 +10:00
/**
* Invoice Ninja (https://invoiceninja.com).
2019-05-11 13:32:07 +10:00
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
2019-05-11 13:32:07 +10:00
*
2021-06-16 16:58:16 +10:00
* @license https://www.elastic.co/licensing/elastic-license
2019-05-11 13:32:07 +10:00
*/
2019-03-26 15:46:08 +11:00
namespace App\Models;
2020-02-27 10:32:44 +11:00
use Illuminate\Database\Eloquent\SoftDeletes;
2019-03-26 15:46:08 +11:00
class CompanyToken extends BaseModel
2019-03-26 15:46:08 +11:00
{
2020-02-27 10:32:44 +11:00
use SoftDeletes;
use Filterable;
protected $fillable = [
'name',
2019-03-27 08:17:28 +11:00
];
2019-03-26 15:46:08 +11:00
2019-04-25 20:21:07 +10:00
protected $with = [
];
2020-07-23 13:55:11 +10:00
protected $touches = [];
public function getEntityType()
{
return self::class;
}
2019-03-26 15:46:08 +11:00
public function account()
{
return $this->belongsTo(Account::class);
}
public function user()
{
return $this->belongsTo(User::class);
2019-03-26 15:46:08 +11:00
}
public function company()
{
return $this->belongsTo(Company::class);
2019-03-26 15:46:08 +11:00
}
2020-08-08 09:50:32 +10:00
public function company_user()
{
return $this->hasOne(CompanyUser::class, 'user_id', 'user_id')
2020-08-08 09:50:32 +10:00
->where('company_id', $this->company_id)
->where('user_id', $this->user_id);
}
2019-03-26 15:46:08 +11:00
}