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