1

I would like to display the table based on SESSION USERNAME and using the following query but I am getting error.

SELECT tb_list.* FROM tb_list  
WHERE username = ".Session::get('username')."

Error: Class 'App\Models\Session' not found

Could you please help me

Regards

1 Answer 1

1

You have to use Session class like:

use Session; 

or

use Illuminate\Support\Facades\Session;
Sign up to request clarification or add additional context in comments.

2 Comments

Ye the second one worked. Thank you very much. But it works only when it is WHERE id = ".Session::get('uid')." How can I make it work with WHERE username = ".Session::get('username')."
For logged in user, You can try this one WHERE username = Auth::user()->username

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.