php - Lavarel Error : ErrorException Missing argument 1? -


i using laravel 4 , getting error: when visit admin/profile/: missing argument 1 admincontroller::getprofile()

my admincontroller code :

 public function getprofile($id) {      if(is_null($id)) redirect::to('admin/dashboard'); $user = user::find($id); $this->layout->content = view::make('admin.profile', array('user' => $user));   } 

my routes.php :

route::controller('admin', 'admincontroller'); 

my admin/profile (blade) view :

 @if(!is_null($user->id))  {{ $user->id }}   @endif  

how fix / want when go admin/profile without ($id) redirect dashboard?

please help!!!

try setting default null value $id :

public function getprofile($id = null) {    ... } 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -