#### How to get data from db and how does the session work in laravel?

I am a native PHP programmer and I started learning Laravel a few days ago. I am struggling with how to get data from the database. Usually (in native), I use a query and OOP to connect to the DB and execute queries, but in Laravel it is a little weird and I don’t get it.

Example, I want to get data from the database where user_id = 1.

### Last but not least

In vanilla PHP I assigned auto user_id without login by using a session, for example:

if (!isset($_SESSION['user_id'])) {$id = // random function to generate random numbers
$_SESSION['user_id'] =$id;
}

I don’t know how to do it in Laravel. Please remember that anything will help me so don’t hesitate to tell me.

Source: Laravel