Anonymous
Вызов функции-члена setPath() для объекта, не являющегося объектом, в laravel
Сообщение
Anonymous » 27 ноя 2024, 02:38
В моем веб-приложении Laravel при использовании нумерации страниц появляется ошибка типа «Вызов функции-члена setPath() для объекта, не являющегося объектом».
Мой код
В модели
Код: Выделить всё
public function scopegetApartments()
{
$list1 = DB::table('properties')->orderBy('id','DESC')->paginate(1);
$list = array();
foreach($list1 as $listeach){
$imgs = DB::table('property_images')->where('property_id',$listeach->id)->get();;
$images = array();
foreach($imgs as $img){
array_push($images, $img->image);
}
$lists = array(
'id'=>$listeach->id,
'name'=>$listeach->name,
'rent'=>$listeach->rent,
'shortdescription'=>$listeach->shortdescription,
'images'=>$images,
);
array_push($list, $lists);
}
if(count($list)>0){
return $list;
}else{
return '[]';
}
}
На виду,
Код: Выделить всё
$apartmentlist->setPath('serviceapartments');
echo $apartmentlist->render();
Как решить эту проблему?
Подробнее здесь:
https://stackoverflow.com/questions/407 ... in-laravel
1732664324
Anonymous
В моем веб-приложении Laravel при использовании нумерации страниц появляется ошибка типа «Вызов функции-члена setPath() для объекта, не являющегося объектом». Мой код В модели [code]public function scopegetApartments() { $list1 = DB::table('properties')->orderBy('id','DESC')->paginate(1); $list = array(); foreach($list1 as $listeach){ $imgs = DB::table('property_images')->where('property_id',$listeach->id)->get();; $images = array(); foreach($imgs as $img){ array_push($images, $img->image); } $lists = array( 'id'=>$listeach->id, 'name'=>$listeach->name, 'rent'=>$listeach->rent, 'shortdescription'=>$listeach->shortdescription, 'images'=>$images, ); array_push($list, $lists); } if(count($list)>0){ return $list; }else{ return '[]'; } } [/code] На виду, [code] $apartmentlist->setPath('serviceapartments'); echo $apartmentlist->render(); [/code] Как решить эту проблему? Подробнее здесь: [url]https://stackoverflow.com/questions/40758968/call-to-a-member-function-setpath-on-a-non-object-in-laravel[/url]