rework components

This commit is contained in:
TimmensOne
2023-03-29 22:32:49 +02:00
parent 7a8e277887
commit 656056a3b3
17 changed files with 217 additions and 33 deletions

View File

@@ -5,11 +5,18 @@ namespace App\Models;
use App\Models\Device;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class LocationTransaction extends Model
{
use HasFactory;
/**
* The table associated with the model.
* @var string
*/
protected $table = 'location_transactions';
/**
* The primary key associated with the devices table.
* @var string
@@ -23,7 +30,10 @@ class LocationTransaction extends Model
*/
protected $fillable = ['location_transaction_id', 'room_code', 'timestamp_located_since', 'device_id'];
public function device() {
return $this->belongsTo(Device::class, 'device_id');
public function device(): BelongsTo {
return $this->belongsTo(Device::class, 'device_id', 'device_id');
}
//Timestamps are disabled.
public $timestamps = false;
}