@@ 97-117 (lines=21) @@ | ||
94 | return view('laravel-blog::blog.show', compact('blogPost')); |
|
95 | } |
|
96 | ||
97 | public function showYearMonthSlug($year, $month, LaravelBlog $blogPost) |
|
98 | { |
|
99 | if (! $blogPost->published && ! auth()->user()) { |
|
100 | abort(404); |
|
101 | } |
|
102 | ||
103 | if (config('laravel-blog.permalink') == 'slug') { |
|
104 | return redirect()->route('showSlug', ['blogPost' => $blogPost->slug] |
|
105 | ); |
|
106 | } |
|
107 | if (config('laravel-blog.permalink') == 'id') { |
|
108 | return redirect()->route('showID', ['id' => $blogPost->id] |
|
109 | ); |
|
110 | } |
|
111 | if (config('laravel-blog.permalink') == 'year/month/day/slug') { |
|
112 | return redirect()->route('showYearMonthDaySlug', ['year'=>$year, 'month'=>$month, 'day'=>\Carbon\Carbon::parse($blogPost->published_at)->day, 'blogPost' => $blogPost->slug] |
|
113 | ); |
|
114 | } |
|
115 | ||
116 | return view('laravel-blog::blog.show', compact('blogPost')); |
|
117 | } |
|
118 | ||
119 | public function showYearMonthDaySlug($year, $month, $day, LaravelBlog $blogPost) |
|
120 | { |
|
@@ 119-138 (lines=20) @@ | ||
116 | return view('laravel-blog::blog.show', compact('blogPost')); |
|
117 | } |
|
118 | ||
119 | public function showYearMonthDaySlug($year, $month, $day, LaravelBlog $blogPost) |
|
120 | { |
|
121 | if (! $blogPost->published && ! auth()->user()) { |
|
122 | abort(404); |
|
123 | } |
|
124 | if (config('laravel-blog.permalink') == 'slug') { |
|
125 | return redirect()->route('showSlug', ['blogPost' => $blogPost->slug] |
|
126 | ); |
|
127 | } |
|
128 | if (config('laravel-blog.permalink') == 'id') { |
|
129 | return redirect()->route('showID', ['id' => $blogPost->id] |
|
130 | ); |
|
131 | } |
|
132 | if (config('laravel-blog.permalink') == 'year/month/slug') { |
|
133 | return redirect()->route('showYearMonthSlug', ['year'=>$year, 'month'=>$month, 'blogPost' => $blogPost->slug] |
|
134 | ); |
|
135 | } |
|
136 | ||
137 | return view('laravel-blog::blog.show', compact('blogPost')); |
|
138 | } |
|
139 | ||
140 | public function showID($id) |
|
141 | { |