This Query Of get bookmarks is working with condition without relation with user_topics
$bookmarkedposts = BookmarkedPost::where('leader_id',$user_id)->get(); But When I add add relation to other model it didn't work
$bookmarkedposts = BookmarkedPost::where('leader_id',$user_id)->with('user_topics.first_media')->get(); Here is Bookmarked.php
namespace App\Models; use Illuminate\Database\Eloquent\Model; class BookmarkedPost extends Model { public function user_topics() { return $this->hasOne('App\UserTopic','id')->where('isdelete',0)->where('isactive',1); } } bookmarked_posts_table_sturucture user_topics_table_stucture
BookmarkedPost.php->with()doesn't exactly do anything on its own... What is your expected result, and what is actually happening?