93 lines
2.2 KiB
PHP
93 lines
2.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\Process\WatchTypeEnum;
|
|
use App\Enums\Process\OriginEnum;
|
|
use App\Enums\Process\BenefitEnum;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property integer $id
|
|
* @property integer $user_id
|
|
* @property boolean $watch_type
|
|
* @property string $supplier
|
|
* @property string $name
|
|
* @property string $description
|
|
* @property boolean $origin
|
|
* @property boolean $is_test_machine
|
|
* @property boolean $is_quotation
|
|
* @property string $quotation_document
|
|
* @property boolean $profit
|
|
* @property string $observation
|
|
* @property string $picture
|
|
* @property string $documents
|
|
* @property string $url
|
|
* @property string $created_at
|
|
* @property string $updated_at
|
|
* @property string $deleted_at
|
|
* @property ProcessHasProcessType[] $processHasProcessTypes
|
|
* @property User $user
|
|
*/
|
|
class Process extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
protected $fillable = [
|
|
'user_id',
|
|
'watch_type',
|
|
'supplier',
|
|
'name',
|
|
'description',
|
|
'origin',
|
|
'is_test_machine',
|
|
'is_quotation',
|
|
'quotation_document',
|
|
'profit',
|
|
'observation',
|
|
'picture',
|
|
'documents',
|
|
'url',
|
|
'created_at',
|
|
'updated_at',
|
|
'deleted_at'
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $casts = [
|
|
'watch_type' => WatchTypeEnum::class,
|
|
'origin' => OriginEnum::class,
|
|
'is_test_machine' => 'boolean',
|
|
'is_quotation' => 'boolean',
|
|
'profit' => BenefitEnum::class,
|
|
'picture' => 'json',
|
|
'documents' => 'json',
|
|
'created_at' => 'datetime:Y-m-d',
|
|
'updated_at' => 'datetime:Y-m-d',
|
|
'deleted_at' => 'datetime:Y-m-d',
|
|
];
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
*/
|
|
public function processHasProcessTypes()
|
|
{
|
|
return $this->hasMany('App\Models\ProcessHasProcessType', 'process_id');
|
|
}
|
|
|
|
/**
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
*/
|
|
public function user()
|
|
{
|
|
return $this->belongsTo('App\Models\User');
|
|
}
|
|
}
|