0

So, I was wondering which is the best way include a single view (views/login.blade.php) into a layout loader, so I won't have to repeat all the code again.

This is my route that loads the login view:

Route::get('login', function() {
    return View::make('login');
});

And I've read the Templating in Laravel but they talk about controllers or blade layouts, no routes layout.

Any idea?

Community
  • 1
  • 1
Alex
  • 7,538
  • 23
  • 84
  • 152

3 Answers3

2

You could instead use the controller route so that you have something like

Route::get('login', array('uses' => 'login@index'))

And in your login controller you have

class Login_Controller extends Base_Controller {

        public $restful = true;    

        public function get_index()
        {
            return View::make('login');
        } 
    }
kaning
  • 137
  • 2
  • 7
1

I just found some Laravel Forum posts explaining ways of doing templating

And this blog article:

Alex
  • 7,538
  • 23
  • 84
  • 152
0

I like to use it like that:

login page is extending content section of main layout. I like login pages with full page (navigation, header etc.)

matiit
  • 7,969
  • 5
  • 41
  • 65