Support the ongoing development of Laravel.io →
Requests Input Architecture
Last updated 3 months ago.
0

By all means experiment with different ways, I don't think theres any right/wrong answers when it comes to questions like this one. I would go about creating a PagesController and an ArchiveController.

// routes.php

// Static Pages
Route::get('/', ['as' => 'home', 'uses' => '[email protected]']);
Route::get('/about', 'as' => 'about', 'uses' => '[email protected]']);

// Archives
Route::get('/archives', ['as' => 'list-archives', 'uses' => '[email protected]']);
Route::get('/archives/topic/{slug}', ['as' => 'browse-by-topic', 'uses' => '[email protected]']);
Route::get('/archives/date/{date}', ['as' => 'list-archives', 'browse-by-date' => '[email protected]']);

// PagesController.php
class PagesController extends BaseController {

    public function showLandingPage()
    {
        return View::make('static.home');
    }

    public function showAboutUsPage()
    {
        return View::make('static.about');
    }

}


// ArchivesController.php
class ArchivesController extends BaseController {

    public function listRecentArchives()
    {
        // Get recent archives from wherever they are stored
        $archives = [];

        return View::make('archives.index')->withArchives($archives);
    }

    public function browseByTopic($slug)
    {
        // Get archives from wherever stored using the topic slug
        $archives = [];

        return View::make('archives.browse')->withArchives($archives);
    }

    public function browseByDate($date)
    {
        // Get archives from wherever stored using the date provided
        $archives = [];

        return View::make('archives.browse')->withArchives($archives);
    }

}
Last updated 3 months ago.
0

Sign in to participate in this thread!

Full Stack Europe

Your banner here too?

nkiermaier nkiermaier nkiermaier Joined 11 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 Laravel.io - All rights reserved.