I found the solution. Kind of dumb of me not to look deeper into the Laravel 4 code. I thought layouts were chained somewhere deep in the core, but it was just the Controller, which has a "callAction" function. This function sets up the layout and then calls the right method.
Below is the code for this, taken from here:
https://laracasts.com/discuss/channels/general-discussion/laravel-5-this-layout-content-not-working
<?php namespace App\Http\Controllers;
use Illuminate\Routing\Controller;
class BaseController extends Controller {
protected $layout = 'core::layouts.default';
/**
* Show the user profile.
*/
public function setContent($view, $data = [])
{
if ( ! is_null($this->layout))
{
return $this->layout->nest('child', $view, $data);
}
return view($view, $data);
}
/**
* Set the layout used by the controller.
*
* @param $name
* @return void
*/
protected function setLayout($name)
{
$this->layout = $name;
}
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
{
if ( ! is_null($this->layout))
{
$this->layout = view($this->layout);
}
}
public function callAction($method, $parameters)
{
$this->setupLayout();
$response = call_user_func_array(array($this, $method), $parameters);
if (is_null($response) && ! is_null($this->layout))
{
$response = $this->layout;
}
return $response;
}
}