Answer the question
In order to leave comments, you need to log in
How to use ORM in this case?
Hello, I ran into a problem in laravel 4, google does not help.
View request
DB::table('user')->leftJoin('payments', function($join) {
$join->on('entity_type', '=', 'salary')
->on('entity_id', '=', 'user.id')
})->get()
Answer the question
In order to leave comments, you need to log in
Method description:
Then in order for the second parameter to be interpreted as a value, and not a field, you need to specify $where true
DB::table('user')->leftJoin('payments', function($join) {
$join->on('entity_type', '=', 'salary', 'and', true)
->on('entity_id', '=', 'user.id')
})->get()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question