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
Post a Comment