Support the ongoing development of Laravel.io →
Requests Input Architecture
Last updated 1 year 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' => 'PagesController@showLandingPage']);
Route::get('/about', 'as' => 'about', 'uses' => 'PagesController@showAboutUsPage']);

// Archives
Route::get('/archives', ['as' => 'list-archives', 'uses' => 'ArchiveController@listRecentArchives']);
Route::get('/archives/topic/{slug}', ['as' => 'browse-by-topic', 'uses' => 'ArchiveController@browseByTopic']);
Route::get('/archives/date/{date}', ['as' => 'list-archives', 'browse-by-date' => 'ArchiveController@browseByDate']);

// 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 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

nkiermaier nkiermaier Joined 11 Sep 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.