1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace App\Models\CustomArticle;
- use App\Models\User\UserModel;
- use Illuminate\Database\Eloquent\Model;
- class Comment extends Model
- {
- //
- protected $table = "kdgx_custom_article_comments";
- public $dateFormat = 'U';
- protected $fillable = [
- 'article_id',
- 'uid',
- 'content',
- 'thumb',
- 'content',
- 'deleted_at',
- 'top_at',
- ];
- public function article()
- {
- return $this->belongsTo(Article::class);
- }
- public function user()
- {
- return $this->belongsTo(UserModel::class, 'uid', 'uid')->select('nickname', 'headimgurl');
- }
- public function reply()
- {
- return $this->hasOne(Reply::class, 'comment_id', 'id');
- }
- }
|