Skip to content

Commit

Permalink
🐛 Null safely in relationships with position
Browse files Browse the repository at this point in the history
  • Loading branch information
aislandener committed May 17, 2022
1 parent f1dde55 commit 53ae9a6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.5.1
* Null safely in relationship Asset <---> Position
* Null safely in relationship Driver <---> Position

## 0.5.0
* Create migration for Position.
* Create model for Position.
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "aislandener/mix-telematics-laravel",
"description": "MiX Telematics Communication API with Laravel",
"type": "library",
"version": "0.5.0",
"version": "0.5.1",
"require": {
"php": "^8.0",
"jumbojett/openid-connect-php": "^0.9.3",
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function group(): BelongsTo
return $this->belongsTo(Group::class,'SiteId','GroupId');
}

public function position() : HasOne
public function position() : ?HasOne
{
return $this->hasOne(Position::class, 'AssetId', 'AssetId');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Models/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function group():BelongsTo
return $this->belongsTo(Group::class,'SiteId', 'GroupId');
}

public function position() : HasOne
public function position() : ?HasOne
{
return $this->hasOne(Position::class, 'DriverId', 'DriverId');
}
Expand Down

0 comments on commit 53ae9a6

Please sign in to comment.