Domanda

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?

È stato utile?

Soluzione 2

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

And this blog article:

Altri suggerimenti

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top