2018-10-15 14:40: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
|
|
|
|
*
|
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
|
|
|
|
*/
|
2018-10-15 14:40:34 +02:00
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
2020-01-20 05:53:40 +01:00
|
|
|
use App\Models\Filterable;
|
2018-11-20 05:36:56 +01:00
|
|
|
use App\Utils\Traits\MakesHash;
|
2018-10-15 14:40:34 +02:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2020-01-20 02:31:58 +01:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2018-10-15 14:40:34 +02:00
|
|
|
|
2018-11-02 11:54:46 +01:00
|
|
|
class Expense extends BaseModel
|
2018-10-15 14:40:34 +02:00
|
|
|
{
|
2020-01-20 02:31:58 +01:00
|
|
|
use SoftDeletes;
|
2020-01-20 05:53:40 +01:00
|
|
|
use Filterable;
|
2018-11-20 05:36:56 +01:00
|
|
|
|
2020-01-20 02:31:58 +01:00
|
|
|
protected $fillable = [
|
|
|
|
'client_id',
|
|
|
|
'vendor_id',
|
|
|
|
'expense_currency_id',
|
|
|
|
'expense_date',
|
|
|
|
'invoice_currency_id',
|
|
|
|
'amount',
|
|
|
|
'foreign_amount',
|
|
|
|
'exchange_rate',
|
|
|
|
'private_notes',
|
|
|
|
'public_notes',
|
|
|
|
'bank_id',
|
|
|
|
'transaction_id',
|
|
|
|
'expense_category_id',
|
|
|
|
'tax_rate1',
|
|
|
|
'tax_name1',
|
|
|
|
'tax_rate2',
|
|
|
|
'tax_name2',
|
|
|
|
'tax_rate3',
|
|
|
|
'tax_name3',
|
|
|
|
'payment_date',
|
|
|
|
'payment_type_id',
|
|
|
|
'transaction_reference',
|
|
|
|
'invoice_documents',
|
|
|
|
'should_be_invoiced',
|
|
|
|
'custom_value1',
|
|
|
|
'custom_value2',
|
|
|
|
'custom_value3',
|
|
|
|
'custom_value4',
|
2018-11-20 05:36:56 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
|
2020-01-20 02:31:58 +01:00
|
|
|
protected $casts = [
|
|
|
|
'is_deleted' => 'boolean',
|
|
|
|
'updated_at' => 'timestamp',
|
|
|
|
'created_at' => 'timestamp',
|
|
|
|
'deleted_at' => 'timestamp',
|
|
|
|
];
|
2018-11-20 05:36:56 +01:00
|
|
|
|
2020-05-06 13:49:42 +02:00
|
|
|
public function getEntityType()
|
|
|
|
{
|
|
|
|
return Expense::class;
|
|
|
|
}
|
2019-04-28 07:31:32 +02:00
|
|
|
|
|
|
|
public function documents()
|
|
|
|
{
|
|
|
|
return $this->morphMany(Document::class, 'documentable');
|
|
|
|
}
|
2019-11-05 11:16:38 +01:00
|
|
|
|
|
|
|
public function assigned_user()
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
return $this->belongsTo(User::class, 'assigned_user_id', 'id');
|
2019-11-05 11:16:38 +01:00
|
|
|
}
|
2018-10-15 14:40:34 +02:00
|
|
|
}
|