2018-10-15 23:40:34 +11:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
2019-04-03 11:09:22 +11:00
|
|
|
use App\Models\Filterable;
|
2018-11-20 15:36:56 +11:00
|
|
|
use App\Utils\Traits\MakesHash;
|
2018-10-15 23:40:34 +11:00
|
|
|
use Illuminate\Database\Eloquent\Model;
|
2019-04-03 11:09:22 +11:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2018-10-15 23:40:34 +11:00
|
|
|
|
2018-11-02 21:54:46 +11:00
|
|
|
class Product extends BaseModel
|
2018-10-15 23:40:34 +11:00
|
|
|
{
|
2018-11-20 15:36:56 +11:00
|
|
|
use MakesHash;
|
2019-04-03 11:09:22 +11:00
|
|
|
use SoftDeletes;
|
|
|
|
|
use Filterable;
|
|
|
|
|
|
2018-11-20 15:36:56 +11:00
|
|
|
protected $guarded = [
|
2019-04-03 13:34:28 +11:00
|
|
|
'id',
|
|
|
|
|
'updated_at',
|
|
|
|
|
'created_at',
|
|
|
|
|
'deleted_at',
|
|
|
|
|
'q',
|
|
|
|
|
];
|
2018-11-20 15:36:56 +11:00
|
|
|
|
2019-04-03 11:09:22 +11:00
|
|
|
public function company()
|
2018-11-20 15:36:56 +11:00
|
|
|
{
|
2019-04-03 11:09:22 +11:00
|
|
|
return $this->belongsTo(Company::class);
|
2018-11-20 15:36:56 +11:00
|
|
|
}
|
|
|
|
|
|
2019-04-03 11:09:22 +11:00
|
|
|
public function user()
|
2018-11-20 15:36:56 +11:00
|
|
|
{
|
2019-04-03 11:09:22 +11:00
|
|
|
return $this->belongsTo(User::class);
|
2018-11-20 15:36:56 +11:00
|
|
|
}
|
2019-04-03 11:09:22 +11:00
|
|
|
|
2019-04-28 15:31:32 +10:00
|
|
|
public function documents()
|
|
|
|
|
{
|
|
|
|
|
return $this->morphMany(Document::class, 'documentable');
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-03 11:09:22 +11:00
|
|
|
|
2018-10-15 23:40:34 +11:00
|
|
|
}
|