changes to management
This commit is contained in:
56
app/Models/Box.php
Normal file
56
app/Models/Box.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\AuditLogTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Box extends BaseModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
use HasFactory;
|
||||
use AuditLogTrait;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* Note: the current database schema uses the legacy table name "boxs".
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'boxs';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $fillable = [
|
||||
'rack_id',
|
||||
'code',
|
||||
'name',
|
||||
'rows',
|
||||
'columns',
|
||||
'capacity',
|
||||
BaseModel::CREATED_AT_FIELD,
|
||||
BaseModel::CREATED_BY_FIELD,
|
||||
BaseModel::UPDATED_AT_FIELD,
|
||||
BaseModel::UPDATED_BY_FIELD,
|
||||
BaseModel::DELETED_AT_FIELD,
|
||||
BaseModel::DELETED_BY_FIELD,
|
||||
BaseModel::RECORD_STATUS_FIELD,
|
||||
];
|
||||
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
public function rack()
|
||||
{
|
||||
return $this->belongsTo(Rack::class, 'rack_id', 'id');
|
||||
}
|
||||
|
||||
public function positions()
|
||||
{
|
||||
return $this->hasMany(Position::class, 'box_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user