Get 2024 Templates Mega Bundle!14 Bootstrap, Vue & React Templates + 3 Vector Sets
Get for 99$

How to change demo page in Laravel project?


I'm working on a Laravel project and I'm struggling to switch the default demo page into another demo page.
I'm not sure where to begin and afraid of damaging the project.

I would appreciate it if you could guide me through switching the demo page step by step.

I need guidance on switching the demo page of a Laravel project. Can you help me with the steps?


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


Here is some general guide.

1. Visit the Metronic Layout Builder.
Download the HTML files of the demo layout you want to use. Eg.
https://preview.keenthemes.com/metronic8/demo60/layout-builder.html

2. Create a Folder in Resources:
Inside your Laravel project, create a new folder to store the layout files. For example, create a folder named layout inside the resources/views directory.

3. Rename HTML Files to Blade.php:
Move the downloaded HTML files into the resources/views/layout folder.
Rename each HTML file to have a .blade.php extension. You can use the following command to rename all files in a directory:

find /path/to/your/directory -type f -name "*.html" -exec sh -c "mv "$0" "${0%.html}.blade.php"" {} \;


4. Update Blade Includes:
Open the renamed files (_default.blade.php, etc.) in a code editor.
Change the include statements to Blade syntax. For example, change:

<!--layout-partial:layout/_default.html-->

to

@include("layout._default")


5. Link the Include in Your Views:
Wherever you want to use the new layout, replace the include statement with the Blade syntax. For example, if you were including _default.html in your welcome.blade.php file, change:

@include("layout._default")

Ensure that the path is correct based on your project structure.

This guide assumes a basic directory structure. Adjust the paths and filenames based on your Laravel project structure. If you have specific file organization in your project, make sure to reflect that in the file paths and includes.



Thank you for your guidance. With your help, I can now make changes to the demo page.



You're welcome! I'm glad I could help. If you have any more questions or if there's anything else I can assist you with, feel free to ask.



Rename files on Windows PS.
# Set your directory path here
$directory = "C:\Users\xxx\xxx"

# Get all .html files in the directory and its subdirectories
$files = Get-ChildItem -Path $directory -Recurse -Filter *.html

# Loop through each file and rename the extension
foreach ($file in $files) {
$newName = $file.FullName -replace '\.html$', '.blade.php'
Rename-Item $file.FullName $newName
}

Write-Host "Renaming complete."


Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Here's a how to add some HTML formatting to your comment:
  • <pre></pre> for JS codes block
  • <pre lang="html"></pre> for HTML code block
  • <pre lang="scss"></pre> for SCSS code block
  • <pre lang="php"></pre> for PHP code block
  • <code></code> for single line of code
  • <strong></strong> to make things bold
  • <em></em> to emphasize
  • <ul><li></li></ul>  to make list
  • <ol><li></li></ol>  to make ordered list
  • <h3></h3> to make headings
  • <a></a> for links
  • <img> to paste in an image
  • <blockquote></blockquote> to quote somebody
  • happy  :)
  • shocked  :|
  • sad  :(