Skip to content

Commit

Permalink
Merge pull request #48 from lara-zeus/factory
Browse files Browse the repository at this point in the history
restore the post factory
  • Loading branch information
atmonshi authored Sep 16, 2022
2 parents aa93772 + 565182e commit f7f7347
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace LaraZeus\Sky\Models;

use Database\Factories\PostFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Blade;
Expand All @@ -14,11 +15,6 @@ class Post extends Model implements HasMedia
{
use HasFactory, HasTags, InteractsWithMedia, PostScope, HasTranslations;

public function getRouteKeyName()
{
return 'slug';
}

public $translatable = [
'title',
'content',
Expand Down Expand Up @@ -46,6 +42,16 @@ public function getRouteKeyName()
'sticky_until' => 'datetime',
];

protected static function newFactory(): PostFactory
{
return PostFactory::new();
}

public function getRouteKeyName()
{
return 'slug';
}

public function statusDesc(): string
{
$PostStatus = PostStatus::where('name', $this->status)->first();
Expand Down

0 comments on commit f7f7347

Please sign in to comment.