change posts to articles

This commit is contained in:
2023-04-26 10:57:27 +10:00
parent c6d318bbc3
commit 3ee97468f9
23 changed files with 416 additions and 486 deletions

49
app/Models/Article.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
namespace App\Models;
use App\Traits\Uuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\MorphMany;
class Article extends Model
{
use HasFactory;
use Uuids;
/**
* The attributes that are mass assignable.
*
* @var array<int, string>
*/
protected $fillable = [
'title',
'slug',
'publish_at',
'content',
'user_id',
'hero'
];
/**
* Get the article user
*
* @return BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class);
}
/**
* Get all of the article's attachments.
*
* @return MorphMany
*/
public function attachments()
{
return $this->morphMany('App\Models\Attachment', 'attachable');
}
}