@@ -69,7 +69,6 @@ public function __construct(array $attributes = [])
6969 $ this ->metatable = $ this ->wpPrefix .'postmeta ' ;
7070
7171 $ this ->appends = [
72- 'wichtig ' ,
7372 'verantwortlicher ' ,
7473 'gultig_bis ' ,
7574 'turnus ' ,
@@ -82,16 +81,8 @@ public function __construct(array $attributes = [])
8281 'post_date_gmt ' => 'datetime ' ,
8382 'post_modified ' => 'datetime ' ,
8483 'post_modified_gmt ' => 'datetime ' ,
85- 'wichtig ' => 'boolean ' ,
8684 ];
8785
88- public function scopeWichtig ($ query )
89- {
90- return $ query ->whereHas ('meta ' , function ($ query ) {
91- $ query ->where ('meta_key ' , 'wichtig ' );
92- });
93- }
94-
9586 public function getVerantwortlicherAttribute ()
9687 {
9788 return $ this ->getMeta ('verantwortlicher ' ) ?? null ;
@@ -177,4 +168,19 @@ public function author()
177168 {
178169 return $ this ->belongsTo (WpUser::class, 'post_author ' , 'ID ' );
179170 }
171+
172+ public function taxonomies ()
173+ {
174+ return $ this ->belongsToMany (WpTermTaxonomy::class, config ('press.wordpress_prefix ' ).'term_relationships ' , 'object_id ' , 'term_taxonomy_id ' );
175+ }
176+
177+ public function categories ()
178+ {
179+ return $ this ->taxonomies ()->where ('taxonomy ' , 'category ' );
180+ }
181+
182+ public function tags ()
183+ {
184+ return $ this ->taxonomies ()->where ('taxonomy ' , 'post_tag ' );
185+ }
180186}
0 commit comments