changes to management
This commit is contained in:
52
app/Models/Rack.php
Normal file
52
app/Models/Rack.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Traits\AuditLogTrait;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class Rack extends BaseModel
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
use HasFactory;
|
||||
use AuditLogTrait;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'racks';
|
||||
|
||||
protected $primaryKey = 'id';
|
||||
|
||||
protected $fillable = [
|
||||
'equipment_id',
|
||||
'code',
|
||||
'name',
|
||||
'description',
|
||||
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 equipment()
|
||||
{
|
||||
return $this->belongsTo(Equipment::class, 'equipment_id', 'id');
|
||||
}
|
||||
|
||||
public function boxes()
|
||||
{
|
||||
return $this->hasMany(Box::class, 'rack_id', 'id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user