Tag: Laravel 5

  • Laravel 5: Create controller under new folder and routing

    So here I am on a Sunday, trying to make progress with a personal Laravel 5 site I need to work on. As I bear with the noise outside in the street (some crazy neighbors set up a swimming pool IN THE STREET! :oops:), I’m trying to figure out how too create a new Laravel 5 controller and place it inside a sub-folder.

    Thanks to a StackOverflow answer as my guide, it’s now working. Here, I’ll share how I did it. Just replace “New” with whatever name you want.

    First, create NewController.php on this folder: app\Http\Controllers\New\

    Then the first part of the code should be like:

    My call for the blade file in index() looks like this:

    In app\Http\routes.php, add this:

    $router->get(‘/new’, ‘New\PostsController@index’);

    Last, run composer dump-autoload or php artisan dump

    Guide: Laravel Controller Subfolder routing

  • Laravel 5 Folder Structure, Before and After


    Hey! 🙂 This is a page I’m preparing quickly for developers who are used to the folder structure of Laravel 4 and older, just to serve as reference on where we can find things in Laravel 5 now.

    If like me, you are new to Laravel 5 but have developed apps using older Laravel versions, you might also be a little confused with the new folder structure. Let the following table of data guide you. Don’t worry, after a while, I’m sure you’ll get used to the Laravel 5 folder structure. 🙂

    Find what? Before Laravel 5 In Laravel 5
    routes.php /app/routes.php /app/Http/routes.php
    Controllers Folder /app/controllers /app/Http/Controllers
    Models Folder /app/models usually /app or /app/models
    Views Folder /app/views /resources/views
    Config Folder /app/config /config

    I know, I wrote this Laravel 5 setup tutorial earlier. But I honestly haven’t really gotten used to the changes in Laravel 5 yet because I got caught up in learning Android app development. Not a bad thing though! 😀