2019-11-10 21:30:26 +01:00
|
|
|
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace Engelsystem\Models;
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use Engelsystem\Models\User\UsesUserModel;
|
2019-11-12 21:49:43 +01:00
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
2019-11-10 21:30:26 +01:00
|
|
|
use Illuminate\Database\Query\Builder as QueryBuilder;
|
|
|
|
|
|
|
|
/**
|
2019-11-12 21:49:43 +01:00
|
|
|
* @property int $id
|
|
|
|
* @property string $title
|
|
|
|
* @property string $text
|
|
|
|
* @property bool $is_meeting
|
|
|
|
* @property Carbon|null $created_at
|
|
|
|
* @property Carbon|null $updated_at
|
|
|
|
*
|
|
|
|
* @property-read Collection|NewsComment[] $comments
|
2019-11-10 21:30:26 +01:00
|
|
|
*
|
|
|
|
* @method static QueryBuilder|LogEntry[] whereId($value)
|
|
|
|
* @method static QueryBuilder|LogEntry[] whereTitle($value)
|
|
|
|
* @method static QueryBuilder|LogEntry[] whereText($value)
|
|
|
|
* @method static QueryBuilder|LogEntry[] whereIsMeeting($value)
|
|
|
|
* @method static QueryBuilder|LogEntry[] whereCreatedAt($value)
|
|
|
|
* @method static QueryBuilder|LogEntry[] whereUpdatedAt($value)
|
|
|
|
*/
|
|
|
|
class News extends BaseModel
|
|
|
|
{
|
|
|
|
use UsesUserModel;
|
|
|
|
|
|
|
|
/** @var bool Enable timestamps */
|
|
|
|
public $timestamps = true;
|
|
|
|
|
|
|
|
/** @var array */
|
|
|
|
protected $casts = [
|
|
|
|
'is_meeting' => 'boolean',
|
|
|
|
];
|
|
|
|
|
|
|
|
/** @var array */
|
|
|
|
protected $fillable = [
|
|
|
|
'title',
|
|
|
|
'text',
|
|
|
|
'is_meeting',
|
|
|
|
'user_id',
|
|
|
|
];
|
2019-11-12 21:49:43 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return HasMany
|
|
|
|
*/
|
|
|
|
public function comments(): HasMany
|
|
|
|
{
|
|
|
|
return $this->hasMany(NewsComment::class)
|
|
|
|
->orderBy('created_at');
|
|
|
|
}
|
2019-11-10 21:30:26 +01:00
|
|
|
}
|