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

Record is removed when BelongsTo record is null #32

Closed
hiteshmungpara opened this issue Nov 16, 2018 · 2 comments
Closed

Record is removed when BelongsTo record is null #32

hiteshmungpara opened this issue Nov 16, 2018 · 2 comments

Comments

@hiteshmungpara
Copy link

hiteshmungpara commented Nov 16, 2018

I have Post model and User model

i have some post where user_id is null

public function user()
{
return $this->belongsTo('App\User');
}

Post::orderByJoin('user.name');

this only return records where user_id is not null.

how can i solve this. i also want that post where user_id is null

@fico7489
Copy link
Owner

Post::setLeftJoin(true)->orderByJoin('user.name');

@hiteshmungpara
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants