Level 2
@ligonsker I would rather do a
if (Auth::check()) {
DB::table('table')->where('id', Auth::id())->value('colum');
}
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to query some table but also make sure the user is authenticated
is it possible to use both Auth and DB::table? Or do something that would be equivalent to that?
because I want to create an accessor for the User which gets data from another table:
DB::table('table')->where('id', some_id)->value('colum');
I was thinking about:
DB::table('table')->where('id', Auth::user()->id)->value('colum');
Will that be equivalent?
Thanks
@ligonsker I would rather do a
if (Auth::check()) {
DB::table('table')->where('id', Auth::id())->value('colum');
}
Please or to participate in this conversation.