add foreign keys and extend models
This commit is contained in:
29
device-app/app/Models/LocationTransaction.php
Normal file
29
device-app/app/Models/LocationTransaction.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Device;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class LocationTransaction extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* 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'];
|
||||
|
||||
public function device() {
|
||||
return $this->belongsTo(Device::class, 'device_id');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user