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

I'm not proud of this solution, but it works:

Blade::directive('carousel', function ($expression) {

            
           $slug = trim($expression, "'");
           
           return "<?php \$carousel = Carousel::with('slide')->where('slug', '=', '{$slug}')->first(); echo \$__env->make( 'www.common._partials.carousel' , ['carousel' => \$carousel])->render(); ?>";
            
        });
0

Sign in to participate in this thread!

Eventy

Your banner here too?

bl8m bl8m Joined 20 Mar 2017

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.