Selim Selim - 2 years ago 151
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;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download