add Comment persistence: model, migration, eloquent + fake repo
This commit is contained in:
parent
0d589340d9
commit
93da08756c
4 changed files with 219 additions and 0 deletions
43
backend/app/Comment/CommentModel.php
Normal file
43
backend/app/Comment/CommentModel.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace App\Comment;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $post_id
|
||||
* @property int $user_id
|
||||
* @property string $body
|
||||
* @property DateTimeImmutable $created_at
|
||||
*
|
||||
* @method static Builder<static>|CommentModel newModelQuery()
|
||||
* @method static Builder<static>|CommentModel newQuery()
|
||||
* @method static Builder<static>|CommentModel query()
|
||||
* @method static Builder<static>|CommentModel whereId($value)
|
||||
* @method static Builder<static>|CommentModel wherePostId($value)
|
||||
* @method static Builder<static>|CommentModel whereUserId($value)
|
||||
* @method static Builder<static>|CommentModel whereBody($value)
|
||||
* @method static Builder<static>|CommentModel whereCreatedAt($value)
|
||||
*
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class CommentModel extends Model
|
||||
{
|
||||
protected $table = 'comments';
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $fillable = [
|
||||
'post_id',
|
||||
'user_id',
|
||||
'body',
|
||||
'created_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'created_at' => 'immutable_datetime',
|
||||
];
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue