46 lines
1.5 KiB
PHP
46 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property int $thread_id
|
|
* @property int|null $user_id
|
|
* @property string $body
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
* @property-read \App\Models\Thread $thread
|
|
* @property-read \App\Models\User|null $user
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post whereBody($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post whereThreadId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post whereUpdatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder<static>|Post whereUserId($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Post extends Model
|
|
{
|
|
protected $fillable = [
|
|
'thread_id',
|
|
'user_id',
|
|
'body',
|
|
];
|
|
|
|
public function thread(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Thread::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|