corcel / corcel

Use WordPress backend with Laravel or any PHP application

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to do where() statement ?

ivanradojevic-web-dev opened this issue · comments

  • "jgrossi/corcel": "^5.0",
  • "laravel/framework": "^8.0",
  • "php": "^8.0",

Description:

$object = \Corcel\Model\Post::where('slug', $slug);

Steps To Reproduce:

//Corcel $object 
commented

In WordPress, slug is stored as post_name. You can call it like this:

\Corcel\Model\Post::where('post_name', $slug)

Most of the time, I use the helper method:

$post::slug($slug)