emfpc's avatar
Level 1

Make the home (localhost) from a index controller

Greetings,

In my current application I have has the home a small form that i get from a simple view:

Route::get('/', function () {
    $md_list = MedicalPlansList::all();
   return view('Form.guestForm', compact('md_list'));
  
});

At the last minute i need to change the home to another page that in order to access it you need to type

localhost/dashboard

I cant simple put return view dashboard since this view is getting data from a controller in the index

Route::resource('dashboard', 'DashboardController')->middleware('auth');

How can i make the dashboard, without typing on the heather localhost/dashboard, as the home without moving / copying everything on the Controller index?

Thank you for your help

0 likes
2 replies
Sergiu17's avatar

Hi, if I understood you, you could do something like this

Route::get('/', 'DashboardController@index');
Route::resource('dashboard', 'DashboardController')->middleware('auth')->except(['index']);

Please or to participate in this conversation.