How to Include a Blade Template Only if it Exists in Laravel
In this lesson, we will see how to include a blade template only if it exists in Laravel.
Sometimes, we want to include a blade template only if it exists to avoid errors, so how can we do that?
Check if the blade template exists
To do that as the code below shows we use "@includeIf" to check if the blade template exists.
@includeIf('alerts.blade.php',['alert' => 'success']);