35 lines
677 B
PHP
35 lines
677 B
PHP
<?php
|
|
|
|
namespace App\Models\Store;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
|
|
class Device extends Model
|
|
{
|
|
use HasDateTimeFormatter;
|
|
|
|
protected $table = 'store_devices';
|
|
|
|
protected $fillable = ['device_no', 'extra', 'name', 'remarks', 'status', 'store_id', 'type'];
|
|
|
|
protected $casts = [
|
|
'extra' => 'json'
|
|
];
|
|
|
|
protected $attributes = [
|
|
'type' => 'print',
|
|
'status' => 1
|
|
];
|
|
|
|
public function store()
|
|
{
|
|
return $this->belongsTo(Store::class, 'store_id');
|
|
}
|
|
|
|
public function records()
|
|
{
|
|
return $this->hasMany(DeviceRecord::class, 'device_id');
|
|
}
|
|
}
|