Reputation: 703
I'm trying to do something very simple.
Route::get('/', function () {
return Route::view('/welcome', 'welcome');
});
I just want to it to load the welcome
view and change the URI to /welcome
. However, as you can see it keeps throwing the error Object of class Illuminate\Routing\Route could not be converted to string
.
I haven't touched Laravel in a minute and am kind of doing a refresher and tried to set up a simple site. I may be missing something totally obvious but I have no idea what it could be.
Any help would be much appreciated.
Upvotes: 0
Views: 1453
Reputation: 2292
You can either use
Route::view('/','welcome');
Or use
Route::get('/', function () {
return view('welcome');
});
I guess you are mixing two different syntax.
Upvotes: 0
Reputation: 624
I think your mean like
Route::redirect('/', '/welcome', 301);
Route::view('/welcome', 'welcome');
or
//one view like resources/views/welcome.blade.php
Route::get('/', function () {
return view('welcome');
});
But in fact we usually use .htaccess redirect request, because you must load all requires before do anything in framework.
Upvotes: 1