29 lines
587 B
PHP
29 lines
587 B
PHP
<?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');
|
|
}
|
|
}
|