prepared and gallery fixes
This commit is contained in:
21
app/Models/ForumAttachment.php
Normal file
21
app/Models/ForumAttachment.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ForumAttachment extends Model
|
||||
{
|
||||
protected $table = 'forum_attachments';
|
||||
|
||||
protected $fillable = [
|
||||
'id','post_id','file_path','file_size','mime_type','width','height'
|
||||
];
|
||||
|
||||
public $incrementing = true;
|
||||
|
||||
public function post()
|
||||
{
|
||||
return $this->belongsTo(ForumPost::class, 'post_id');
|
||||
}
|
||||
}
|
||||
26
app/Models/ForumCategory.php
Normal file
26
app/Models/ForumCategory.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ForumCategory extends Model
|
||||
{
|
||||
protected $table = 'forum_categories';
|
||||
|
||||
protected $fillable = [
|
||||
'id', 'name', 'slug', 'parent_id', 'position'
|
||||
];
|
||||
|
||||
public $incrementing = true;
|
||||
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo(ForumCategory::class, 'parent_id');
|
||||
}
|
||||
|
||||
public function threads()
|
||||
{
|
||||
return $this->hasMany(ForumThread::class, 'category_id');
|
||||
}
|
||||
}
|
||||
33
app/Models/ForumPost.php
Normal file
33
app/Models/ForumPost.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ForumPost extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'forum_posts';
|
||||
|
||||
protected $fillable = [
|
||||
'id','thread_id','user_id','content','is_edited','edited_at'
|
||||
];
|
||||
|
||||
public $incrementing = true;
|
||||
|
||||
protected $casts = [
|
||||
'edited_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function thread()
|
||||
{
|
||||
return $this->belongsTo(ForumThread::class, 'thread_id');
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
{
|
||||
return $this->hasMany(ForumAttachment::class, 'post_id');
|
||||
}
|
||||
}
|
||||
33
app/Models/ForumThread.php
Normal file
33
app/Models/ForumThread.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ForumThread extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'forum_threads';
|
||||
|
||||
protected $fillable = [
|
||||
'id','category_id','user_id','title','slug','content','views','is_locked','is_pinned','visibility','last_post_at'
|
||||
];
|
||||
|
||||
public $incrementing = true;
|
||||
|
||||
protected $casts = [
|
||||
'last_post_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function category()
|
||||
{
|
||||
return $this->belongsTo(ForumCategory::class, 'category_id');
|
||||
}
|
||||
|
||||
public function posts()
|
||||
{
|
||||
return $this->hasMany(ForumPost::class, 'thread_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user