I am trying to use corcel to retrieve data from wordpress in laravel.

if i use like this, it show the error like this

$posts = AppPost::published()->get();
return $posts;

BadMethodCallException in Builder.php line 2451: Call to undefined
method IlluminateDatabaseQueryBuilder::published()

But if i use like this

 $posts = AppPost::all();
 return $posts;`

it works.Help me out where am i missing to do.
Thanks in advance.

Read more here: How to get the published posts in laravel using corcel?


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Wordpress related questions and answers: