1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-06 03:02:34 +01:00
invoiceninja/app/Models/Product.php

65 lines
1.3 KiB
PHP
Raw Normal View History

<?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
*/
namespace App\Models;
2019-04-03 02:09:22 +02:00
use App\Models\Filterable;
use App\Utils\Traits\MakesHash;
use Illuminate\Database\Eloquent\Model;
2019-04-03 02:09:22 +02:00
use Illuminate\Database\Eloquent\SoftDeletes;
class Product extends BaseModel
{
use MakesHash;
2019-04-03 02:09:22 +02:00
use SoftDeletes;
use Filterable;
protected $fillable = [
'custom_value1',
'custom_value2',
'custom_value3',
'custom_value4',
'product_key',
'notes',
'cost',
'price',
2019-09-04 14:01:19 +02:00
'quantity',
'tax_name1',
'tax_name2',
'tax_name3',
'tax_rate1',
'tax_rate2',
'tax_rate3',
2019-04-03 04:34:28 +02:00
];
2019-04-03 02:09:22 +02:00
public function company()
{
2019-04-03 02:09:22 +02:00
return $this->belongsTo(Company::class);
}
2019-04-03 02:09:22 +02:00
public function user()
{
return $this->belongsTo(User::class)->withTrashed();
}
2019-04-03 02:09:22 +02:00
public function assigned_user()
{
return $this->belongsTo(User::class ,'assigned_user_id', 'id')->withTrashed();
}
2019-04-28 07:31:32 +02:00
public function documents()
{
return $this->morphMany(Document::class, 'documentable');
}
2019-04-03 02:09:22 +02:00
}