Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 1 year ago.
0

where('user_contition', '=', 1); i think you need '1' (not sure just a guess)

Last updated 1 year ago.
0

did try this - but the error remains the same...

Last updated 1 year ago.
0

Maybe the whereHas() method helps. Not exactly a join, but it will do what you want.

$posts = Post::whereHas('comments', function($q)
{
    $q->where('content', 'like', 'foo%');

})->get();
Last updated 1 year ago.
0

There is no where clause on a join row. Either use it on your parent query or use another on.

DB::table('users')
	->join('contacts', function($join) {
		$join->on('users.id', '=', 'contacts.user_id');
	})
	->where('contacts.user_condition', 1)
	->get();
DB::table('users')
	->join('contacts', function($join) {
		$join->on('users.id', '=', 'contacts.user_id');
		$join->on('contacts.user_condition', '=', DB::raw(1));
	})
	->get();
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

diwa9904 diwa9904 Joined 6 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.