Support the ongoing development of Laravel.io →
Views Blade
Last updated 1 year ago.
0
Last updated 8 years ago.
0

I had same issue. What slillo recommended is over-complicated in my opinion. Just declare a variable in an Util class.

Add this to your Util.php

public static $isReportModalIncluded = false;

then in your blade do this

@php

	//include this only once
	if (\App\Classes\Utils::$isReportModalIncluded === true) {
		return;
	}
	
	if (\App\Classes\Utils::$isReportModalIncluded === false) {
		\App\Classes\Utils::$isReportModalIncluded = true;
	}

	
@endphp

Hopefully Laravel will introduce an @includeonce in the future

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

agoransson agoransson Joined 24 Mar 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.

© 2024 Laravel.io - All rights reserved.