I have a user table structure like :
id | user_id | name
second table is booking table
id | user_id | category_id | booking_amt
Now i want to get all the data from booking table where user_id and category_id gets matched.
I'm trying something like this:
I'm getting all data from users table:
$query = User::where(['active'=>1])->get();
Booking Model:
public function getAssociatedDealer()
{
return $this->hasMany('App\Models\Booking', 'user_id', 'category_id');
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire