Selim Selim - 8 months ago 78
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


Answer Source

You have to use Session class like:

use Session; 


use Illuminate\Support\Facades\Session;