abschlussprojekt-device-man.../device-app/app/Models/LocationTransaction.php

39 lines
941 B
PHP
Raw Normal View History

2023-03-28 22:17:54 +02:00
<?php
namespace App\Models;
use App\Models\Device;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
2023-03-29 22:32:49 +02:00
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2023-03-28 22:17:54 +02:00
class LocationTransaction extends Model
{
use HasFactory;
2023-03-29 22:32:49 +02:00
/**
* The table associated with the model.
* @var string
*/
protected $table = 'location_transactions';
2023-03-28 22:17:54 +02:00
/**
* The primary key associated with the devices table.
* @var string
*/
protected $primaryKey = 'location_transaction_id';
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = ['location_transaction_id', 'room_code', 'timestamp_located_since', 'device_id'];
2023-03-29 22:32:49 +02:00
public function device(): BelongsTo {
return $this->belongsTo(Device::class, 'device_id', 'device_id');
2023-03-28 22:17:54 +02:00
}
2023-03-29 22:32:49 +02:00
//Timestamps are disabled.
public $timestamps = false;
2023-03-28 22:17:54 +02:00
}