Hello I am new to laravel, I want to loop through a data table and get each id of it in a variable. So i did it like this, but unfortunatly nothing works
$station_id = 0;
$stations = Station::all();
foreach ($stations as $station) {
$station_id = $station->id;
}
return $station_id;
this only showing the last id;
[1, 5, 7]
?