feat : 테이블 및 DB 마이그레이션 파일 추가
products - common_codes - parts - products - files - price_histories - boms - bom_items boards - boards - board_settings - posts - board_comments - board_files - post_custom_field_values permissions - menus - roles - user_menu_permissions - role_menu_permissions tenants - tenants - plans - subscriptions - payments
This commit is contained in:
30
app/Models/Boards/Post.php
Normal file
30
app/Models/Boards/Post.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Boards;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'posts';
|
||||
protected $fillable = [
|
||||
'tenant_id', 'board_id', 'user_id', 'title', 'content', 'editor_type',
|
||||
'ip_address', 'is_notice', 'is_secret', 'views', 'status'
|
||||
];
|
||||
|
||||
public function customFieldValues() {
|
||||
return $this->hasMany(PostCustomFieldValue::class, 'post_id');
|
||||
}
|
||||
public function files() {
|
||||
return $this->hasMany(BoardFile::class, 'post_id');
|
||||
}
|
||||
public function comments() {
|
||||
return $this->hasMany(BoardComment::class, 'post_id')->whereNull('parent_id')->where('status', 'active');
|
||||
}
|
||||
public function board() {
|
||||
return $this->belongsTo(Board::class, 'board_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user