How to change the views file path in laravel? helps of this example you will change your blade file views path in your laravel application. by default application blade file path is resources/views, So if you want to change the blade file this post will help to change.
To change the default blade file path from the resources views to another directory, we need to change the little default laravel application configuration. therefore we need to open the view.php file inside the config available.
Open the view.php file, and there will be a paths attribute, this path is already in resources, as you can see in your application. just add your new blade file there and dump your application. see below given example.
config/view.php<?php
return [
/*
|--------------------------------------------------------------------------
| View Storage Paths
|--------------------------------------------------------------------------
|
| Most templating systems load templates from disk. Here you may specify
| an array of paths that should be checked for your views. Of course
| the usual Laravel view path has already been registered for you.
|
*/
'paths' => [
resource_path('views'), // ADD NEW BLADE FILE PATH HERE
],
/*
|--------------------------------------------------------------------------
| Compiled View Path
|--------------------------------------------------------------------------
|
| This option determines where all the compiled Blade templates will be
| stored for your application. Typically, this is within the storage
| directory. However, as usual, you are free to change this value.
|
*/
'compiled' => env(
'VIEW_COMPILED_PATH',
realpath(storage_path('framework/views'))
),
];
We always thanks to you for reading our blogs.
Dharmesh Chauhan
(Swapinfoway Founder)Hello Sir, We are brothers origin from Gujarat India, Fullstack developers working together since 2016. We have lots of skills in web development in different technologies here I mention PHP, Laravel, Javascript, Vuejs, Ajax, API, Payment Gateway Integration, Database, HTML5, CSS3, and Server Administration. So you need our service Please Contact Us
Haresh Chauhan
(Co-Founder)We Are Also Recommending You :
- Laravel 10 Restful API Passport Authentication Tutorial
- How to Create Zip File and Download in Laravel
- Laravel 10 Breeze Integration Tutorial Example
- Laravel Database Based Dynamic Mail Configuration Set Example
- Web Push Notification Send Using Firebase Cloud Messaging In Laravel Tutorial Include Demo Example
- Laravel 6 validation with error message
- Call to undefined function Gregwar\Captcha\imagecreatetruecolor()
- Laravel Debugging Methods With Example
- Trying to access array offset on value of type int
- Laravel 10 Create Custom Helper Function Example