Skip to content

Commit

Permalink
Merge pull request #33 from lara-zeus/slug
Browse files Browse the repository at this point in the history
remove RouteKeyName slug
  • Loading branch information
atmonshi authored Aug 31, 2022
2 parents eac36a7 + 9d98032 commit 3dfedb8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 1 addition & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
->middleware(config('zeus-sky.middleware'))
->group(function () {
Route::get('/', Posts::class)->name('blogs');
Route::get(config('zeus-sky.post_uri_prefix').'/{post:slug}', Post::class)->name('post');
Route::get(config('zeus-sky.post_uri_prefix').'/{slug}', Post::class)->name('post');
Route::get(config('zeus-sky.page_uri_prefix').'/{slug}', Page::class)->name('page');
Route::get('{type}/{slug}', Tags::class)->name('tags');

Expand Down
6 changes: 3 additions & 3 deletions src/Http/Livewire/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

class Post extends Component
{
public postModel $post;
public $post;

public function mount(postModel $post)
public function mount($slug)
{
$this->post = $post;
$this->post = postModel::whereSlug($slug)->firstOrFail();
}

public function render()
Expand Down
5 changes: 0 additions & 5 deletions src/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ protected static function newFactory()
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 3dfedb8

Please sign in to comment.