You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
706 B
39 lines
706 B
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
class Bed extends SoftDeletesModel
|
|
{
|
|
protected $table = "bed";
|
|
|
|
public function area()
|
|
{
|
|
return $this->belongsTo(Area::class);
|
|
}
|
|
|
|
public function building()
|
|
{
|
|
return $this->belongsTo(Building::class);
|
|
}
|
|
|
|
public function project()
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function room()
|
|
{
|
|
return $this->belongsTo(Room::class);
|
|
}
|
|
|
|
public function orders()
|
|
{
|
|
return $this->hasMany(Orders::class, "bed_id");
|
|
}
|
|
|
|
public function onGoingOrder()
|
|
{
|
|
return $this->hasOne(Orders::class, "bed_id")->where("orders.status", Orders::STATUS_ONGOING);
|
|
}
|
|
}
|