47 lines
1.1 KiB
PHP
47 lines
1.1 KiB
PHP
<?php
|
||
|
||
namespace App\Models;
|
||
|
||
use Illuminate\Database\Eloquent\Model;
|
||
|
||
class Manufacturer extends Model
|
||
{
|
||
protected $table = 'manufacturer';
|
||
protected $connection = 'vat_warehouse';
|
||
|
||
// Enable Laravel’s created_at / updated_at
|
||
public $timestamps = true;
|
||
|
||
/**
|
||
* The attributes that are mass assignable.
|
||
* (We guard out `id` and the computed `_name` column.)
|
||
*/
|
||
protected $fillable = [
|
||
'name',
|
||
'description',
|
||
'ext_id',
|
||
'created_by',
|
||
'updated_by',
|
||
];
|
||
|
||
/**
|
||
* The attributes that should be cast to native types.
|
||
*/
|
||
protected $casts = [
|
||
'id' => 'integer',
|
||
'ext_id' => 'integer',
|
||
'created_by' => 'integer',
|
||
'updated_by' => 'integer',
|
||
'created_at' => 'datetime',
|
||
'updated_at' => 'datetime',
|
||
// _name is a stored generated column, so you’ll get it automatically
|
||
'_name' => 'string',
|
||
];
|
||
|
||
|
||
public function physicalItems()
|
||
{
|
||
return $this->hasMany(PhysicalItem::class, 'manufacturer_id');
|
||
}
|
||
}
|