I am trying to write a custom directive in laravel. However, it only returns the path of my blade partial as a string, not the actual html like @include does.
@customInclude('authenticated/partials/header2')
Blade::directive('customInclude', function($partial){
if(Config::get('constants.ORG_ID') === 'organizationId'){
return "<?php echo $partial; ?>";
}
});
I want the custom directive to return the html found in the path 'authenticated/partials/header2' , however, it seems that blade is not recognizing that the path is a path in my php. My custom directive lives in the AppServiceProvider.php file btw. Does anyone know how @include works really well so they can explain why my path isn't being recognized.