2018-10-12 13:29:34 +02:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2018-10-12 13:29:34 +02:00
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2018-11-20 05:36:56 +01:00
|
|
|
use App\Utils\Traits\MakesHash;
|
2018-10-12 13:29:34 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2018-10-22 14:04:37 +02:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
use Laracasts\Presenter\PresentableTrait;
|
2018-10-12 13:29:34 +02:00
|
|
|
|
2018-11-02 11:54:46 +01:00
|
|
|
class Account extends BaseModel
|
2018-10-12 13:29:34 +02:00
|
|
|
{
|
2018-10-22 14:04:37 +02:00
|
|
|
use SoftDeletes;
|
|
|
|
use PresentableTrait;
|
2018-11-20 05:36:56 +01:00
|
|
|
use MakesHash;
|
2018-10-15 14:40:34 +02:00
|
|
|
|
|
|
|
/**
|
2018-10-22 14:04:37 +02:00
|
|
|
* @var string
|
2018-10-15 14:40:34 +02:00
|
|
|
*/
|
2018-10-22 14:04:37 +02:00
|
|
|
protected $presenter = 'App\Models\Presenters\AccountPresenter';
|
2018-10-15 14:40:34 +02:00
|
|
|
|
|
|
|
/**
|
2018-10-22 14:04:37 +02:00
|
|
|
* @var array
|
2018-10-15 14:40:34 +02:00
|
|
|
*/
|
2018-10-22 14:04:37 +02:00
|
|
|
protected $fillable = [
|
|
|
|
'plan',
|
|
|
|
'plan_term',
|
|
|
|
'plan_price',
|
|
|
|
'plan_paid',
|
|
|
|
'plan_started',
|
|
|
|
'plan_expires',
|
2018-10-24 05:50:15 +02:00
|
|
|
'utm_source',
|
|
|
|
'utm_medium',
|
|
|
|
'utm_campaign',
|
|
|
|
'utm_term',
|
|
|
|
'utm_content',
|
2018-10-22 14:04:37 +02:00
|
|
|
];
|
2018-10-15 14:40:34 +02:00
|
|
|
|
|
|
|
/**
|
2018-10-22 14:04:37 +02:00
|
|
|
* @var array
|
2018-10-15 14:40:34 +02:00
|
|
|
*/
|
2018-10-22 14:04:37 +02:00
|
|
|
protected $dates = [
|
|
|
|
'deleted_at',
|
|
|
|
'promo_expires',
|
|
|
|
'discount_expires',
|
|
|
|
];
|
2018-10-15 14:40:34 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
|
|
|
|
2018-10-29 04:16:17 +01:00
|
|
|
public function default_company()
|
|
|
|
{
|
2019-03-27 05:50:13 +01:00
|
|
|
return $this->hasOne(Company::class, 'id', 'default_company_id');
|
2018-10-29 04:16:17 +01:00
|
|
|
}
|
2018-10-15 14:40:34 +02:00
|
|
|
/**
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
*/
|
2018-10-22 14:04:37 +02:00
|
|
|
public function payment()
|
2018-10-15 14:40:34 +02:00
|
|
|
{
|
2018-10-22 14:04:37 +02:00
|
|
|
return $this->belongsTo(Payment::class);
|
2018-10-15 14:40:34 +02:00
|
|
|
}
|
2019-06-25 05:55:02 +02:00
|
|
|
|
|
|
|
public function companies()
|
|
|
|
{
|
|
|
|
return $this->hasMany(Company::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function company_users()
|
|
|
|
{
|
|
|
|
return $this->hasMany(CompanyUser::class);
|
|
|
|
}
|
2019-09-18 14:43:37 +02:00
|
|
|
|
|
|
|
public function getPlan()
|
|
|
|
{
|
|
|
|
return $this->plan ?: '';
|
|
|
|
}
|
2018-10-12 13:29:34 +02:00
|
|
|
}
|