#Routes

16 messages ยท Page 1 of 1 (latest)

low schooner
#

Hey everyone! Im new in webdev so don't understand loads of things.
I have main.blade.php page that I want to be as my index page. Everything seems fine but now I don't understand how I can redirect to it. {{ route('main') }} seems wrong.

Route::get('/', function () {
    return view('main');
});

Thank you in advance! ๐Ÿ™‚

gleaming hinge
#

Alternatively you can use url('/') to specify a route without a name..

low schooner
#

ty โค๏ธ

gleaming hinge
#

FYI you can also do Route::view('/', 'main')->name('main')

low schooner
#

thats the same?

gleaming hinge
#

yeah just a shorter way of writing it

low schooner
#

Its been there by default I though its important to have that one there ๐Ÿ˜„

gleaming hinge
#

both are perfectly fine

low schooner
#

cuz rest is short ye

gleaming hinge
#

if your following some sort of tutorial best to stick with it the same

gleaming hinge
#

Those are defining methods on the controller to use, not returning a view directly

#

Personally, I am not a fan of the Route::controller(..) method but you do you ๐Ÿ‘

low schooner
#

so far idk about other ways ๐Ÿ˜„ will see in future