File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 33namespace Javaabu \Cms \Models ;
44
55use Illuminate \Database \Eloquent \Relations \BelongsTo ;
6+ use Illuminate \Database \Eloquent \Relations \HasMany ;
67use Illuminate \Support \Str ;
78use Javaabu \Cms \Enums \PostTypeFeatures ;
89use Javaabu \Helpers \AdminModel \AdminModel ;
@@ -107,6 +108,24 @@ public function getFeatureCollectionName($feature): ?string
107108 return PostTypeFeatures::getCollectionName ($ feature );
108109 }
109110
111+ /**
112+ * A post type has many posts
113+ */
114+ public function userVisiblePosts ()
115+ {
116+ return $ this ->posts ()->userVisibleForPostType ($ this );
117+ }
118+
119+ /**
120+ * A post type has many posts
121+ *
122+ * @return HasMany
123+ */
124+ public function posts (): HasMany
125+ {
126+ return $ this ->hasMany (Post::class, 'type ' , 'slug ' );
127+ }
128+
110129 /**
111130 * Slugify the value
112131 *
You can’t perform that action at this time.
0 commit comments