Support the ongoing development of Laravel.io →
Views Blade

Hello everyone,

Is it possible to use a variable to extend a blade view ? My idea was to create blocks and add them into a "application" view and then call the block function.

The block function will then load a block blade view. Now I need to extend the block blade view to the "application" view.

// In application view.

<!DOCTYPE html>
<html>
	<head>
		{{ Theme::headerBar('_base') }}


// And more....

// In block view 
@extends({{$extend}})

<title>@yield('title')</title>
<meta name="description" content="@yield('description')">


// Block function 
	public static function headerBar($extends) {
		$view = new BaseView();
		$view->make(self::$viewFolder.'headerBar', array('extend'=>$extends));
	}

Can this be done ?

Last updated 3 years ago.
0

I am not sure what you are trying to do but i assume that you are trying to inject partials to your main view? if so check this out:http://robelluna.com/work/laravel-displaying-different-modulepackage-dashboard-widgets-using-view-composers/

0

Sign in to participate in this thread!

Eventy

Your banner here too?

domeinznl domeinznl Joined 7 Sep 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.