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

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -