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