Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
NewsComment
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 news
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Engelsystem\Models;
6
7use Carbon\Carbon;
8use Engelsystem\Models\User\UsesUserModel;
9use Illuminate\Database\Eloquent\Factories\HasFactory;
10use Illuminate\Database\Eloquent\Relations\BelongsTo;
11use Illuminate\Database\Query\Builder as QueryBuilder;
12
13/**
14 * This class represents a news comment.
15 *
16 * @property int         $id
17 * @property int         $news_id
18 * @property string      $text
19 * @property News        $news
20 * @property Carbon|null $created_at
21 * @property Carbon|null $updated_at
22 *
23 * @method static QueryBuilder|NewsComment[] whereId($value)
24 * @method static QueryBuilder|NewsComment[] whereNewsId($value)
25 * @method static QueryBuilder|NewsComment[] whereText($value)
26 * @method static QueryBuilder|NewsComment[] whereCreatedAt($value)
27 * @method static QueryBuilder|NewsComment[] whereUpdatedAt($value)
28 */
29class NewsComment extends BaseModel
30{
31    use HasFactory;
32    use UsesUserModel;
33
34    /** @var bool Enable timestamps */
35    public $timestamps = true; // phpcs:ignore
36
37    /** @var array<string, string> */
38    protected $casts = [ // phpcs:ignore
39        'user_id' => 'integer',
40        'news_id' => 'integer',
41    ];
42
43    /** @var array<string> */
44    protected $fillable = [ // phpcs:ignore
45        'news_id',
46        'text',
47        'user_id',
48    ];
49
50    public function news(): BelongsTo
51    {
52        return $this->belongsTo(News::class);
53    }
54}