dimanche 2 avril 2017

Creating view if not found in laravel 5

I have a controller where I check if the view exists, like so

if (view()->exists($moduleName.$getCategoryNameToLowerCase))
{
       //if exist return the view
       return view($moduleName.$getCategoryNameToLowerCase);
}
else{
       //else create a view and return it;
       return View::make($moduleName.$getCategoryNameToLowerCase);
}

But this is not creating a view and return it. Am I using it in the right way?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire