Support the ongoing development of Laravel.io →
Database Eloquent Installation

How to create a query that brings all the values from a column and that has another column equal to the a value (the auth user)

I tryed

$user = Auth::user()->id;
$taskDistArray = DB::table('user_task')->select(DB::raw('task_id'))->where('user_id','$user')->get()->toArray();

but it doesn't show anything when i dd($taskDistArray)

Last updated 2 years ago.
0
$taskDistArray = DB::table('user_task')->select('task_id')->where('user_id',$user)->get();
Last updated 8 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.

© 2025 Laravel.io - All rights reserved.