35 lines
802 B
PHP
35 lines
802 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||
|
|
|
||
|
|
class Article extends Model
|
||
|
|
{
|
||
|
|
use HasFactory;
|
||
|
|
|
||
|
|
/** The name of the database table storing this Model's records. */
|
||
|
|
protected string $table = 'articles';
|
||
|
|
|
||
|
|
/** The attributes on the Model that can be mass-assigned */
|
||
|
|
protected array $fillable = [
|
||
|
|
'title',
|
||
|
|
'subtitle',
|
||
|
|
'author_id',
|
||
|
|
'slug',
|
||
|
|
'body',
|
||
|
|
'published_at',
|
||
|
|
'header_image_url',
|
||
|
|
'path_to_markdown_source',
|
||
|
|
'processed_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
/** The person that wrote the article. */
|
||
|
|
public function author(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(Author::class);
|
||
|
|
}
|
||
|
|
}
|