if (view()->exists('partials.heading')) { return view('partials.heading', ['data' => $yourHeadingData]); }
If you have multiple blade views you can pass it to the "first()" method as an array and whichever view file exists will be loaded by Laravel.
return view()->first(['partialas.heading', 'partials.heading-alt'], ['data' => $yourHeadingData]);
By having those options now you can conditionally load the views whenever necessary.
Leave a reply