-
most of us use the related table with join query model::selectRow('count(column) as counter') what if add function like model::selectCount('column') // select column as column_count or model::selectCount('column', 'counter') // select column as counter and join table using a model like user::join(member::class); // select * from user join member on member.user_id = user.id
// or
user::join(member::class, 'user_id, 'id');
// or
user::join(member::class, function ($query){
$query->on('member.user_id', '=', 'user.id');
}); using advance select for join like // select user.name, user.age, member.since, member.level from user join member on member.user_id = user.id
user::select('name', 'age')
->memberSelect('since', 'level') // member-class-name + select
->join(member::class) I'm sorry if I'm bad at describing my idea, so I hope you can understand what I mean. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Really good ideas, but it's not gonna happen, for that you can make builder macros, i'm doing that and it's a really less code to write Builder::macro('autoLeftJoin', function($class
Builder::macro('autoRightJoin', function($class
Builder::macro('autoCrossJoin', function($class
Builder::macro('autoInnerJoin', function($class
Builder::macro('autoJoin', function($class |
Beta Was this translation helpful? Give feedback.
-
Why can't you use |
Beta Was this translation helpful? Give feedback.
Really good ideas, but it's not gonna happen, for that you can make builder macros, i'm doing that and it's a really less code to write