love_php/app/Models/CommunityTopic.php

29 lines
587 B
PHP
Raw Normal View History

2026-04-02 09:20:51 +08:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
class CommunityTopic extends Model
{
use SoftDeletes;
public $fillable = ['name', 'creater_id'];
protected $table = 'community_topics';
public function moment(){
return $this->hasMany(CommunityMoment::class, 'topic_id');
}
public function community()
{
return $this->belongsTo(Community::class, 'community_id');
}
public function creater()
{
return $this->hasOne(User::class, 'id', 'creater_id');
}
}