2019-03-26 05:46:08 +01:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
2019-03-26 05:46:08 +01:00
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2020-04-09 12:48:04 +02:00
|
|
|
use App\Models\Filterable;
|
2019-03-26 05:46:08 +01:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2020-02-27 00:32:44 +01:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2019-03-26 05:46:08 +01:00
|
|
|
|
2020-04-09 12:48:04 +02:00
|
|
|
class CompanyToken extends BaseModel
|
2019-03-26 05:46:08 +01:00
|
|
|
{
|
2020-02-27 00:32:44 +01:00
|
|
|
use SoftDeletes;
|
2020-04-09 12:48:04 +02:00
|
|
|
use Filterable;
|
|
|
|
|
|
|
|
protected $fillable = [
|
2020-09-06 11:38:10 +02:00
|
|
|
'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 = [
|
|
|
|
];
|
|
|
|
|
2020-07-23 05:55:11 +02:00
|
|
|
protected $touches = [];
|
2020-07-16 13:01:39 +02:00
|
|
|
|
2020-05-06 13:49:42 +02:00
|
|
|
public function getEntityType()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
return self::class;
|
2020-05-06 13:49:42 +02:00
|
|
|
}
|
|
|
|
|
2019-03-26 05:46:08 +01:00
|
|
|
public function account()
|
|
|
|
{
|
|
|
|
return $this->belongsTo(Account::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function user()
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
return $this->belongsTo(User::class);
|
2019-03-26 05:46:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function company()
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
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()
|
|
|
|
{
|
2020-09-06 11:38:10 +02:00
|
|
|
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);
|
|
|
|
}
|
2019-03-26 05:46:08 +01:00
|
|
|
}
|