add foreign keys and extend models
This commit is contained in:
30
device-app/app/Models/OwnerTransaction.php
Normal file
30
device-app/app/Models/OwnerTransaction.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Models\Device;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
|
||||
class OwnerTransaction extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The primary key associated with the devices table.
|
||||
* @var string
|
||||
*/
|
||||
protected $primaryKey = 'owner_transaction_id';
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = ['owner_transaction_id', 'rz_username', 'timestamp_owner_since', 'device_id'];
|
||||
|
||||
public function device() {
|
||||
return $this->belongsTo(Device::class, 'device_id');
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user