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?

有帮助吗?

解决方案 2

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

And this blog article:

其他提示

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');
        } 
    }

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.)

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top