how can i include an external php file inside laravel blade view?

In Laravel Blade, variable scope is parent to child and not the other way around.

When you are including a Blade View, the rendering only makes the variables available inside the scope of the specific rendering.

You need to either output the $total_price in your included view or make the calculations in the parent (eg. the controller) and pass them to the relevant view.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top