未找到Laravel视图5.2

I am getting 1 error, which is very strange. Error : View [pages.email_templates.welcome_template_5] not found.

But the fact is that view file does exist in the mentioned folder.

I have tried following command but with no luck.

php artisan cache:clear
php artisan config:clear
php artisan config:cache

Controller :

$templatename = strtolower(str_replace(' ','_',$template_text->template_name));
return view('pages.email_templates.'.$templatename);

Best Part : Its working fine in localhost but not in the server

did you tried php artisan dump-autoload or composer dump-autoload ?

First You need to clear your application cache and configuration

php artisan cache:clear
php artisan config:clear
php artisan view:clear

 $string1 = "pages.email_templates";
 $string2 = $templatename = strtolower(str_replace(' ','_',$template_text->template_name));

$page = sprintf("%s%s",$string1,$string2);

return view($page);

Autoload your all classes and class dependencies

composer dump-autoload 

You should try this:

composer dumpautoload
php artisan config:cache
php artisan cache:clear
php artisan config:clear
php artisan view:clear

$templatename = strtolower(str_replace(' ','_',$template_text->template_name));
return view('pages.email_templates.'.$templatename);