php - htmlentities() expects parameter 1 to be string, object given laravel5 -
iam receving error, htmlentities()
expects parameter 1 string, object given. how solve it? controller
public function category() { $recordsbycategories=\db::table('products') ->select('categories', \db::raw('count(*) total')) ->groupby('categories') ->get(); //dd($recordsbycategories); return view('dashboard.show',compact('recordsbycategories')); }
my view
@foreach($recordsbycategories $recordsbycategory) {!!$recordsbycategory->$categories!!} @endforeach
try in view
use {{$recordsbycategory->categories}}
instead of {{$recordsbycategory}}
it because $recordsbycategory
object
one problem here is, when use count(*)
in query return 1 row in result.
Comments
Post a Comment