Files
productalert/app/Models/Post.php
2023-07-27 02:18:38 +08:00

71 lines
1.3 KiB
PHP

<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
/**
* Class Post
*
* @property int $id
* @property string|null $title
* @property string|null $slug
* @property string|null $excerpt
* @property int|null $author_id
* @property string $featured_image
* @property string $editor
* @property array|null $body
* @property string $post_format
* @property int $comment_count
* @property int $likes_count
* @property string $status
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
*
* @property Author|null $author
* @property Collection|PostCategory[] $post_categories
*
* @package App\Models
*/
class Post extends Model
{
protected $table = 'posts';
protected $casts = [
'author_id' => 'int',
'body' => 'json',
'comment_count' => 'int',
'likes_count' => 'int'
];
protected $fillable = [
'title',
'slug',
'excerpt',
'author_id',
'featured_image',
'editor',
'body',
'post_format',
'comment_count',
'likes_count',
'status'
];
public function author()
{
return $this->belongsTo(Author::class);
}
public function post_categories()
{
return $this->hasMany(PostCategory::class);
}
}