Override Controller's Blade Layout in Laravel 4

Laravel Blade system makes it easy to group views and create modular layouts for your application. Although there is currently very limited documentation on how to make best use of the layout functionality.

One problem we ran into was needing to override our controller's template for our login page, to use our default layout template, instead of the administrator layout template.

It made sense to us to keep our log in logic in our Admin controller from a organizational perspective, but it didn't fit in with other admin styles

Here is how to over ride the Laravel 4 Blade layout on a one off basis.

Routes.php
Route::get('login', 'AdminController@login');
layout = View::make('layouts.main');
        // ... Do other login related things
        $this->layout->content = View::make('forms.login');
    }
}
Small dog web development studio

View All Our Posts

Web application developers in western Washington, creating user centric web solutions for businesses of all shapes and sizes.

Our projects include ecommerce, event organization, user driven web applications and more.


Small Dog Studios, LLC. Small Dog Studios News