http://laravel.com/docs/4.2/templatesから:
(コントローラー)
class UserController extends BaseController {
/**
* The layout that should be used for responses.
*/
protected $layout = 'layouts.master';
/**
* Show the user profile.
*/
public function showProfile()
{
$this->layout->content = View::make('user.profile');
}
}
(テンプレート)
@extends('layouts.master')
@section('sidebar')
<p>This is appended to the master sidebar.</p>
@stop
@section('content')
<p>This is my body content.</p>
@stop
なぜlayouts.master
2 回呼び出す必要があるのですか? $this->layout
に設定する必要があるという事実layouts.master
と、に渡す必要があるという事実は、冗長で不要なようですlayouts.master
。@extends()