Skip to content

Commit

Permalink
# v1.11.32
Browse files Browse the repository at this point in the history
-   Fix EloquentRelation prefix morph relations
  • Loading branch information
ewilan-riviere committed Jan 6, 2024
1 parent 1de0280 commit 4086c74
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kiwilan/typescriptable-laravel",
"description": "PHP package for Laravel to type Eloquent models, routes, Spatie Settings with autogenerated TypeScript. If you want to use some helpers with Inertia, you can install associated NPM package.",
"version": "1.11.31",
"version": "1.11.32",
"keywords": [
"kiwilan",
"laravel",
Expand Down
6 changes: 5 additions & 1 deletion src/Typed/Eloquent/Utils/EloquentRelation.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,11 @@ private function parseMorphModel(ReflectionMethod $method)

$this->hasPivot = true;
$this->phpType = $related;
$this->typescriptType = "App.Models.{$related}";

$tsModel = explode('\\', $related);
$this->pivotModel = $tsModel[count($tsModel) - 1];
$this->typescriptType = 'App.Models.'.$tsModel[count($tsModel) - 1];

if ($this->isArray) {
$this->typescriptType .= '[]';
}
Expand Down

0 comments on commit 4086c74

Please sign in to comment.