Added MorphTo and anonymous join support
·
131 commits
to master
since this release
Morph To example:
Image::query()->joinMorphRelation('imageable', Post::class);
// SQL: select * from "images" inner join "posts" on "posts"."id" = "images"."imageable_id" and "images"."imageable_type" = ?
Anonymous Join example:
$relation = Relation::noConstraints(function () {
return (new User)
->belongsTo(Country::class, 'country_name', 'name');
});
User::query()->joinRelation($relation);
// SQL: select * from "users" inner join "countries" on "countries"."name" = "users"."country_name"See readme for more details.