Mam taki problem mam w bazie przeszło 70 elemntów a do tablicy zapisuje się tylko 1 element i potem ten jeden elemtn jest drukowany w systemie szablonów blade daje kod.
Tu jest funkcja, która odczytuje.
private function read_staty($page) {
$read = DB::select("select page,id_usera,ip,http_user_agent,date from statystyk");
$i = 0;
$read3 = array();
foreach ($read as $read2) {
//$id_users = $read2->id_usera;
//$user = DB::select("select name from users where id = '$id_users'");
//foreach($user as $user2) {
//if ($user2->name == "") {
//$read2->name = "anonim";
//}
//else {
//$read2->name = $user2->name;
//}
//$read2->name = $user2->name;
//}
//$read3[0][$i] = $read2->name;
//$read3[1][$i] = $read2->page;
//$read3[2][$i] = $read2->ip;
//$read3[3][$i] = $read2->http_user_agent;
//$read3[4][$i] = $read2->date;
//print $read2->page;
//$i++;
}
return $read2;
}
No i szablon blade
<?php
var_dump($staty);
//@foreach ($staty as $staty2)
//{{ $staty2->date }}
//@endforeach;
?>
@for ($i = 0;$i < count($staty);$i++)
{{ $staty->date }}
@endfor;
Dodam że funkcja var_dump też zwraca tylko 1 element tablicy.