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 :
- How to Create Zip File and Download in Laravel
- Laravel debugbar install
- MongoDB Database Connection In Laravel
- Array Convert Into Json Object
- myfatoorah Payment Gateway Integration Laravel
- Laravel 10 PDF Export Example With DomPDF
- Laravel Intervention Image
- How to Get Browser Name and Version in Laravel
- How to send mail example in Laravel 6
- Laravel Remove index.php From URL