Selim Selim - 14 days ago 9
PHP Question

Laravel - sql query with session

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

Answer

You have to use Session class like:

use Session; 

or

use Illuminate\Support\Facades\Session;