Laravel check view file exist or not in folder?

Admin   Laravel   178  2021-03-16 08:00:07

Hello Friends,

Sometime we generate dynamic view blade file at that time we call view file check before. and also it's good check file available or not in folder. how to check if file exists in laravel.

Check In Controller,Model,Repository,Helper

 

use Illuminate\Support\Facades\View;

public function index()

{

if (View::exists('auth.login')) {

//

}

}

Check In View Blade

 

@if(\View::exists('auth.login'))

...

@endif

I hope it can help you...