2019-09-08 12:39:13 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use App\Models\Client;
|
|
|
|
use App\Models\Company;
|
|
|
|
use App\Models\CompanyGateway;
|
2019-09-18 04:39:53 +02:00
|
|
|
use App\Models\GatewayType;
|
2019-09-08 12:39:13 +02:00
|
|
|
use App\Models\User;
|
|
|
|
|
|
|
|
class ClientGatewayToken extends BaseModel
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
protected $casts = [
|
|
|
|
'meta' => 'object',
|
2019-09-26 00:27:26 +02:00
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
'deleted_at' => 'timestamp',
|
2019-12-30 22:59:12 +01:00
|
|
|
];
|
2019-09-18 04:39:53 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function client()
|
|
|
|
{
|
|
|
|
return $this->hasOne(Client::class)->withTrashed();
|
|
|
|
}
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function gateway()
|
|
|
|
{
|
|
|
|
return $this->hasOne(CompanyGateway::class);
|
|
|
|
}
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function gateway_type()
|
|
|
|
{
|
|
|
|
return $this->hasOne(GatewayType::class, 'id', 'gateway_type_id');
|
|
|
|
}
|
2019-09-18 04:39:53 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function company()
|
|
|
|
{
|
|
|
|
return $this->hasOne(Company::class);
|
|
|
|
}
|
2019-09-08 12:39:13 +02:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
public function user()
|
|
|
|
{
|
|
|
|
return $this->hasOne(User::class)->withTrashed();
|
|
|
|
}
|
2019-11-28 11:35:13 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Retrieve the model for a bound value.
|
|
|
|
*
|
|
|
|
* @param mixed $value
|
|
|
|
* @return \Illuminate\Database\Eloquent\Model|null
|
|
|
|
*/
|
|
|
|
public function resolveRouteBinding($value)
|
|
|
|
{
|
|
|
|
return $this
|
|
|
|
->where('id', $this->decodePrimaryKey($value))->firstOrFail();
|
|
|
|
}
|
2019-12-30 22:59:12 +01:00
|
|
|
}
|