-
app/Http/Controllers/Blog/IndexController.php
Open in GitHubuse App\Post; use App\Services\MetaBag; use App\Stream; class IndexController { public function __invoke(MetaBag $meta, int $page = 1) { $meta->title = 'Blog'; $meta->image = mix('images/og/static/blog.png'); $posts = Post::all() ->merge(Stream::all()) ->sortByDesc('date') ->paginate($page) ->withRoute('blog.index'); return view('pages.blog.index', compact('posts')); } }
-
routes/web.php
Open in GitHubuse Illuminate\Support\Facades\Route; Route::prefix('blog')->name('blog.')->group(function (): void { Route::get('{page?}', Blog\IndexController::class)->middleware(Paginated::class)->name('index'); }