Use the route 'as' parameter to give a name to your route:
Route::get('user/profile', array('as' => 'profile', 'uses' => 'UserController@showProfile'));
Then you just have to
<a href="<?=URL::route('profile');?>">Click here to go home</a>
Using your resource routes, you can list them
php artisan routes
And use the name of the route, third column.
Using your example, you'll have 2 base routes: home and users, this is the list for the home resources:
+--------+----------------------+--------------+------------------------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+----------------------+--------------+------------------------------------------+----------------+---------------+
| | GET home | home.index | Admin\Controllers\HomeController@index | | |
| | GET home/create | home.create | Admin\Controllers\HomeController@create | | |
| | POST home | home.store | Admin\Controllers\HomeController@store | | |
| | GET home/{home} | home.show | Admin\Controllers\HomeController@show | | |
| | GET home/{home}/edit | home.edit | Admin\Controllers\HomeController@edit | | |
| | PUT home/{home} | home.update | Admin\Controllers\HomeController@update | | |
| | PATCH home/{home} | | Admin\Controllers\HomeController@update | | |
| | DELETE home/{home} | home.destroy | Admin\Controllers\HomeController@destroy | | |
+--------+----------------------+--------------+------------------------------------------+----------------+---------------+
So you'll build that route using:
<a href="<?=URL::route('home.index');?>">Click here to go home</a>
Note that the your group prefix adminpanel
won't be added to your routes names and you don't have to use it. What you need to create your routes is the exact name the command artisan routes
shows in Name
column.
Using Blade you can just do
{{ link_to_route('home.index', 'Click here to go home') }}
Much cleaner, right?