Mark S
Mark S

Reputation: 1

Connecting HTML to existing Laravel

I have installed Laravel script which has his own front page (homepage) which i dont like and wanted to replace with my own html. I moved css, images to public folder, renames index.html to index.blade.php (moved to resources/views) and added routing - Route::get('/index2', function () {return view('index2');}); but it does not load my homepage. I changed all links to css inside my home.blade.php like this - /assets/css/styles.css" rel="stylesheet"> .

  1. There is an existing routing -Route::get('/','HomeController@index'); which loads old homepage. Do i remove it or leave it be?
  2. And why it's named different - homecontroller@index?

Thank you for your help!

Upvotes: 0

Views: 228

Answers (1)

Apurv Bhavsar
Apurv Bhavsar

Reputation: 620

First of all, remove the default Route from web.php and Add below code

Route::get('/', function () {
    return view('index'); //Change blade as per your file name
})->name('home');

homecontroller@index This is the default controller and index method which you get. Basically in index method returns the default welcome page blade. You can use that as well if you want.

  1. Divide your HTML code into Separate small components. So you can extend the same code in different files.
  2. Use a named route instead of a direct URL in <a href="route('home')"></a> like this.

Upvotes: 0

Related Questions