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

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -