Skip to content

Commit 16ca55f

Browse files
authored
Merge pull request #2 from MatthiasHertel/master
there is no route for blog/id ? .. have to use blog/slug for correct …
2 parents 5087e89 + 7340895 commit 16ca55f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

app/Http/Controllers/PostController.php

+2
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ public function destroy($id)
183183
$post = Post::find($id);
184184
$post->tags()->detach();
185185

186+
$post->tags()->detach();
187+
186188
$post->delete();
187189

188190
Session::flash('success', 'The post was successfully deleted.');

resources/views/blog/index.blade.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020
<p>{{ substr(strip_tags($post->body), 0, 250) }}{{ strlen(strip_tags($post->body)) > 250 ? '...' : "" }}</p>
2121

22-
<a href="{{ route('blog.single', $post->id) }}" class="btn btn-primary">Read More</a>
22+
<a href="{{ route('blog.single', $post->slug) }}" class="btn btn-primary">Read More</a>
2323
<hr>
2424
</div>
2525
</div>
@@ -34,4 +34,4 @@
3434
</div>
3535

3636

37-
@endsection
37+
@endsection

0 commit comments

Comments
 (0)