Amit Kumar
Jan 12, 2021

--

count(): Parameter must be an array or an object that implements Countable (View: C:\xampp\htdocs\blog\resources\views\posts\index.blade.php)

In this tutorial I’m going to describe how to solve Parameter must be an array or an object that implements countable view:

1 st step:- Go to your Controller -> PostController

and change this code

$posts = Post::all();
return view(‘posts.index’)->with(‘posts’, ‘$posts’);

2nd step use compact method copy this code and simply paste it code would be work 100%

$posts = Post::all();
return view(‘posts.index’,compact(‘posts’));

After using this code is worked

Thanks ….🙏🙏

--

--

Amit Kumar

Hi I am Amit Experienced Web Developer with a demonstrated history of working in the information technology and services industry.