Skip to content

Instantly share code, notes, and snippets.

@j3j5
Created January 19, 2016 20:49
Show Gist options
  • Save j3j5/91e03306e2c4a9d695c0 to your computer and use it in GitHub Desktop.
Save j3j5/91e03306e2c4a9d695c0 to your computer and use it in GitHub Desktop.
<?php
/**
* routes.php would be something like:
*
* Route::get('/my/path/{id}', ['as' => 'ExamplePath', 'uses' => 'ExampleController@getPath']);
*/
// Get the full URL from the current request --> http://example.com/my/path/1
request()->url();
// Get the path from the current request --> my/path/1
request()->path();
// Get the path for the current route --> my/path/{id}
Route::getCurrentRoute()->getPath();
// Get the name for the current route --> ExamplePath
Request::route()->getName();
// Get the action name for the current route --> ExampleController@getPath
Route::getCurrentRoute()->getActionName();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment