-
Notifications
You must be signed in to change notification settings - Fork 288
feature: support return type declarations #404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: support return type declarations #404
Conversation
@nathane, I know it might be a bit annoying, but can you rebase or merge |
Blueprint::supportsReturnTypeHits(); Blueprint::isPHP7OrHigher();
@jasonmccreary I've rebased this branch. Ready for review. |
Problem: Loops return types. If you add multiple relations, you'll get duplicate return types This relationships:
belongsTo: User Team, Generates duplicate return types on the model //first one is ok
public function user(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(\App\Models\User::class);
}
//second is duplicated
public function team(): \Illuminate\Database\Eloquent\Relations\BelongsTo: \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(\App\Models\Team::class);
} |
@tanthammar, thanks for testing this. The relationship models need to be separated with commas. Please retry with proper syntax: relationships:
belongsTo: User, Team |
@jasonmccreary Example: Organizer: {
name: json
description: json nullable
user_id: id nullable foreign onDelete:null
team_id: id foreign
bookon_vat_id: id nullable foreign:vats onDelete:null
default_vat_id: id nullable foreign:vats onDelete:null
softDeletes
relationships:
belongsTo: User, Team
} |
@tanthammar 👋🏾 hey, Please try again without the curly braces |
I opened a ticket #416 because there is probably some issue that I need to solve before I can test this PR. |
@nathane, I'm going to merge this. But may revert it if there are any issues reported unless you can solve them quickly. |
Resolves #401