Skip to content

Conversation

pedroborges
Copy link
Contributor

Thought it would be useful to have a method that checks the uri and returns true or false. So we don't need extra code when views are shared by many routes.

<?php echo Request::is(array('/', 'home')) ? 'Welcome home' : ''; ?>
<?php echo Request::is('user') ? 'User Menu...' : ''; ?>

Let me know what do you think of this :)

@pedroborges
Copy link
Contributor Author

I had a better idea. Thinking of how Wordpress allow you to check what page/url you are in, we could have the option of dynamic finders too, like so:

Request::is_home();
Request::is_user();

@taylorotwell taylorotwell merged commit d446ccc into laravel:develop Jun 18, 2011
@taylorotwell
Copy link
Member

Ah, I just merged it! :) ... feel free to send me another pull request after you work on it some more.

@taylorotwell
Copy link
Member

It would also be nice to have some way of handling routes like /user/(:any)... I guess named routes could cover you there too!

I think this whole feature probably needs to work using named routes.

@pedroborges
Copy link
Contributor Author

Thanks for improving it :)

@taylorotwell
Copy link
Member

No problem. Do you want me to look into adding the named routes feature? Thanks for the great idea!

@pedroborges
Copy link
Contributor Author

Sure :) Thanks!

@taylorotwell
Copy link
Member

This feature has been added! :)

@pedroborges
Copy link
Contributor Author

Yeah, was just testing it! It's working beautifully here :)

sl0wik added a commit to sl0wik/laravel that referenced this pull request Oct 4, 2023
Google Cloud Storage as default file storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants