I am trying to find a users email when I know the project id.
So in my table projects for example I have a record: id: 1 user_id: 6
I know want to find the email of user 6 in my users table: for example: id: 6 email: hello@gmail.com
so as a result I want to get hello@gmail.com
I've tried something like this, but doesn't seem to be working:
$projectOwnerEmail = DB::table('users')
->select('email')
->where('id', '=', $input['project_id'])
->join('projects', 'users.id', '=', 'projects.user_id')
->get();
Many thanks!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire