1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-09-21 08:51:34 +02:00
invoiceninja/app/Models/CompanyToken.php

67 lines
1.4 KiB
PHP
Raw Normal View History

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