Rodney Zanoria
Rodney Zanoria

Reputation: 494

What does this PHP syntax mean in layman's term?

I'm trying to understand a syntax and I would greatly appreciate if someone can tell what this means in layman's term:

Route::get('/member-profile-form', ['as' => 'newmemberprofileform', 'uses' => 'User\MemberProfileFormController@showForm']);

Particularly the one that says 'as'... Thanks!

Upvotes: 1

Views: 55

Answers (1)

Mayank Pandeyz
Mayank Pandeyz

Reputation: 26258

Here get() is the method of Route class, and you are calling it with 2 parameters. The first one is the URI, the second one is the array having 2 indexes in it.

here,

as is used to give the URI a name, means its a named route.

uses define the Controller function by which this URI is served and its a kind of get request here.

According to your question line Particularly the one that says 'as' is used for making a named route.

Note: Giving your route a name with the as option allows you to easily reference that route in other parts of your app. Thanks @Jamesgarrett for reminding me of this.

Named Route Reference

Upvotes: 3

Related Questions