10
10
use Illuminate \Database \Eloquent \Relations \MorphMany ;
11
11
use Spatie \Tags \HasTags ;
12
12
13
+ /**
14
+ * @property int $id
15
+ * @property int|null $blog_author_id
16
+ * @property int|null $blog_category_id
17
+ * @property string $title
18
+ * @property string $slug
19
+ * @property string $content_type markdown, html
20
+ * @property string $content
21
+ * @property \Illuminate\Support\Carbon|null $published_at
22
+ * @property string|null $seo_title
23
+ * @property string|null $seo_description
24
+ * @property string|null $image
25
+ * @property \Illuminate\Support\Carbon|null $created_at
26
+ * @property \Illuminate\Support\Carbon|null $updated_at
27
+ * @property-read User|null $author
28
+ * @property-read \App\Models\Blog\Category|null $category
29
+ * @property-read \Illuminate\Database\Eloquent\Collection<int, Comment> $comments
30
+ * @property-read int|null $comments_count
31
+ * @property \Illuminate\Database\Eloquent\Collection<int, \Spatie\Tags\Tag> $tags
32
+ * @property-read int|null $tags_count
33
+ *
34
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post newModelQuery()
35
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post newQuery()
36
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post query()
37
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post withAllTags(\ArrayAccess|\Spatie\Tags\Tag|array|string $tags, ?string $type = null)
38
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post withAllTagsOfAnyType($tags)
39
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post withAnyTags(\ArrayAccess|\Spatie\Tags\Tag|array|string $tags, ?string $type = null)
40
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post withAnyTagsOfAnyType($tags)
41
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post withAnyTagsOfType(array|string $type)
42
+ * @method static \Illuminate\Database\Eloquent\Builder<static>|Post withoutTags(\ArrayAccess|\Spatie\Tags\Tag|array|string $tags, ?string $type = null)
43
+ *
44
+ * @mixin \Illuminate\Database\Eloquent\Model
45
+ */
13
46
class Post extends Model
14
47
{
15
48
use HasFactory;
@@ -28,20 +61,14 @@ class Post extends Model
28
61
'blog_category_id ' ,
29
62
'title ' ,
30
63
'slug ' ,
64
+ 'content_type ' ,
31
65
'content ' ,
32
66
'published_at ' ,
33
67
'seo_title ' ,
34
68
'seo_description ' ,
35
69
'image ' ,
36
70
];
37
71
38
- /**
39
- * @var array<string, string>
40
- */
41
- protected $ casts = [
42
- 'published_at ' => 'date ' ,
43
- ];
44
-
45
72
/** @return BelongsTo<User,self> */
46
73
public function author (): BelongsTo
47
74
{
@@ -59,4 +86,14 @@ public function comments(): MorphMany
59
86
{
60
87
return $ this ->morphMany (Comment::class, 'commentable ' );
61
88
}
89
+
90
+ /**
91
+ * @return array<string, string>
92
+ */
93
+ protected function casts (): array
94
+ {
95
+ return [
96
+ 'published_at ' => 'date ' ,
97
+ ];
98
+ }
62
99
}
0 commit comments