Laravel 4 - 找出被击中的路线

Well I have a little problem, and I don't know if I'm blind to find it inside the Laravel 4 Documentation or it doesn't even exist ...

I have two routes that route to one and the same controller function...

//List blog_posts
Route::get('/', 'BlogController@listPosts');
//List deleted blog_posts
Route::get('/bin', 'BlogController@listPosts');

Now, is there a way to determine inside the 'listPosts' function what route was hit ?

Of course I could create another function inside 'BlogController' but I dont like that idea ^^

You can try using Route::current(). It will return an object of type Illuminate\Routing\Route which has a method on it called getUri:

var_dump(Route::current()->getUri());

If you gave your routes a name, you can also make a decision based off of that:

var_dump(Route::currentRouteName());

You can also use named routes:

Route::get('/', ['as' => 'listIndex', 'uses' => 'BlogController@listPosts']);
Route::get('/bin', ['as' => 'listBin', 'uses' => 'BlogController@listPosts']);

This will set Route::currentRouteName() which you could if/else on.