Collaboration.php
3 weeks ago
CollaborationComment.php
3 weeks ago
CollaborationCommentSeen.php
3 weeks ago
CollaborationConnected.php
3 weeks ago
CollaborationSent.php
3 weeks ago
Collection.php
3 weeks ago
CollectionItem.php
3 weeks ago
Media.php
3 weeks ago
Page.php
3 weeks ago
Post.php
3 weeks ago
PostMeta.php
3 days ago
Reference.php
3 weeks ago
Term.php
3 weeks ago
TermMeta.php
3 weeks ago
TermTaxonomy.php
3 weeks ago
User.php
3 weeks ago
UserMeta.php
3 weeks ago
Page.php
42 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Kirki\App\Models; |
| 4 | |
| 5 | defined('ABSPATH') || exit; |
| 6 | |
| 7 | use Exception; |
| 8 | use Kirki\App\Traits\HasWordPressPostBehavior; |
| 9 | use Kirki\App\Traits\SearchablePost; |
| 10 | use Kirki\Framework\Database\Query\Model; |
| 11 | |
| 12 | class Page extends Model |
| 13 | { |
| 14 | use SearchablePost, HasWordPressPostBehavior; |
| 15 | |
| 16 | protected $table = 'posts'; |
| 17 | |
| 18 | protected $primary_key = 'ID'; |
| 19 | |
| 20 | protected $timestamps = false; |
| 21 | |
| 22 | public function meta() |
| 23 | { |
| 24 | return $this->has_many(PostMeta::class, 'post_id', 'ID'); |
| 25 | } |
| 26 | |
| 27 | public function taxonomies() |
| 28 | { |
| 29 | return $this->belongs_to_many(TermTaxonomy::class, 'term_relationships', 'object_id', 'term_taxonomy_id'); |
| 30 | } |
| 31 | |
| 32 | public function categories() |
| 33 | { |
| 34 | return $this->taxonomies()->where('taxonomy', 'category'); |
| 35 | } |
| 36 | |
| 37 | public function tags() |
| 38 | { |
| 39 | return $this->taxonomies()->where('taxonomy', 'post_tag'); |
| 40 | } |
| 41 | } |
| 42 |