Skip to content
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

Docs for Laravel style relations #176

Merged
merged 20 commits into from
Oct 9, 2024
Merged

Conversation

bennothommo
Copy link
Member

@bennothommo bennothommo marked this pull request as draft February 27, 2024 08:15
database/relations.md Outdated Show resolved Hide resolved
@bennothommo bennothommo marked this pull request as ready for review February 28, 2024 01:57
database/relations.md Outdated Show resolved Hide resolved
database/relations.md Outdated Show resolved Hide resolved
database/relations.md Outdated Show resolved Hide resolved
database/relations.md Outdated Show resolved Hide resolved
database/relations.md Outdated Show resolved Hide resolved
database/relations.md Outdated Show resolved Hide resolved
database/relations.md Show resolved Hide resolved
database/relations.md Outdated Show resolved Hide resolved
bennothommo and others added 4 commits July 30, 2024 13:09
@LukeTowers
Copy link
Member

@bennothommo do you have any thoughts on the pending comments here?

@LukeTowers
Copy link
Member

@bennothommo ping

@bennothommo
Copy link
Member Author

@LukeTowers I left a comment here for one of your threads: #176 (comment)

@LukeTowers
Copy link
Member

LukeTowers commented Oct 5, 2024

@bennothommo
Copy link
Member Author

@LukeTowers all comments should be resolved now.

@bennothommo bennothommo requested a review from LukeTowers October 8, 2024 02:02
LukeTowers pushed a commit to wintercms/storm that referenced this pull request Oct 9, 2024
This PR allows people to define Laravel-style relations using methods that return Relation objects. So instead of:

public $belongsTo = [
     'user' => User::class,
];

You may use:

public function user(): BelongsTo
{
    return $this->belongsTo(User::class);
}

The main reason for this is to reduce friction for porting Laravel code over to Winter, and as a preference point for people who may wish to use the more declarative style of defining relations.

Documented by wintercms/docs#176
@LukeTowers LukeTowers merged commit 8fb9bef into develop Oct 9, 2024
1 check passed
@LukeTowers LukeTowers deleted the wip/laravel-style-relations branch October 9, 2024 06:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants