Auth: convert auth views and verification email to Nova layout
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class ForumPost extends Model
|
||||
@@ -18,16 +21,42 @@ class ForumPost extends Model
|
||||
public $incrementing = true;
|
||||
|
||||
protected $casts = [
|
||||
'is_edited' => 'boolean',
|
||||
'edited_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function thread()
|
||||
public function thread(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(ForumThread::class, 'thread_id');
|
||||
}
|
||||
|
||||
public function attachments()
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
|
||||
public function attachments(): HasMany
|
||||
{
|
||||
return $this->hasMany(ForumAttachment::class, 'post_id');
|
||||
}
|
||||
|
||||
public function scopeInThread(Builder $query, int $threadId): Builder
|
||||
{
|
||||
return $query->where('thread_id', $threadId);
|
||||
}
|
||||
|
||||
public function scopeVisible(Builder $query): Builder
|
||||
{
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function scopePinned(Builder $query): Builder
|
||||
{
|
||||
return $query->whereHas('thread', fn (Builder $threadQuery) => $threadQuery->where('is_pinned', true));
|
||||
}
|
||||
|
||||
public function scopeRecent(Builder $query): Builder
|
||||
{
|
||||
return $query->orderByDesc('created_at')->orderByDesc('id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user