2024-02-05 02:36:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
|
|
|
|
|
|
class Author extends Model
|
|
|
|
|
{
|
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
|
|
/** The name of the database table storing this Model's records. */
|
2024-08-04 04:49:42 +00:00
|
|
|
protected $table = 'authors';
|
2024-02-05 02:36:25 +00:00
|
|
|
|
|
|
|
|
/** The attributes on the Model that can be mass-assigned */
|
2024-08-04 04:49:42 +00:00
|
|
|
protected $fillable = [
|
2024-02-05 02:36:25 +00:00
|
|
|
'display_name',
|
|
|
|
|
'profile_image_url',
|
|
|
|
|
'user_id',
|
|
|
|
|
'biography',
|
|
|
|
|
'primary_link',
|
|
|
|
|
'secondary_link',
|
|
|
|
|
'mastodon_handle',
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/** The application-level User account of this writer */
|
|
|
|
|
public function user(): HasOne
|
|
|
|
|
{
|
|
|
|
|
return $this->hasOne(User::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** All the Articles this person has written */
|
|
|
|
|
public function articles(): HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(Article::class);
|
|
|
|
|
}
|
|
|
|
|
}
|