finished laravel migration
This commit is contained in:
56
app/Models/Thread.php
Normal file
56
app/Models/Thread.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $forum_id
|
||||
* @property int|null $user_id
|
||||
* @property string $title
|
||||
* @property string $body
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\Models\Forum $forum
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection<int, \App\Models\Post> $posts
|
||||
* @property-read int|null $posts_count
|
||||
* @property-read \App\Models\User|null $user
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereBody($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereForumId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|Thread whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Thread extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'forum_id',
|
||||
'user_id',
|
||||
'title',
|
||||
'body',
|
||||
];
|
||||
|
||||
public function forum(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Forum::class);
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function posts(): HasMany
|
||||
{
|
||||
return $this->hasMany(Post::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user