rework components
This commit is contained in:
@ -4,11 +4,18 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PurchasingInformation extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
* @var string
|
||||
*/
|
||||
protected $table = 'purchasing_information';
|
||||
|
||||
/**
|
||||
* The primary key associated with the devices table.
|
||||
* @var string
|
||||
@ -22,7 +29,10 @@ class PurchasingInformation extends Model
|
||||
*/
|
||||
protected $fillable = ['purchasing_information_id', 'price', 'timestamp_warranty_end', 'timestamp_purchase', 'cost_centre', 'seller', '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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user