I'm attempting to build up a query in Laravel.
I have two tables, with the following attirbuteds
User
- id (auto)
- name
- userType
- password
TenantPreferance
- id (auto)
- county
- type
- user_id (this is the user who created their preference)
I'm trying to get a collection of data from users of a certain type where id of the user, matches the user_id in preferences.
But I get this error
Undefined property: Illuminate\Database\Eloquent\Builder::$id
$tenants = User::where('userType', 'tenant');
$Prefereances = TenantPreferance::where($tenants->id, $Prefereances->user_id);
$users = $Prefereances->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire