Laravel 4 Undefined offset: 0 (View: users.blade.php) -
i have error coming time undefined offset: 0 (view: users.blade.php)
here code of index()
in usercontroller
:
public function index() { // try{ // find user using user id $user = sentry::getuser(); // find administrator group $admin = sentry::findgroupbyname('admin'); $groups = array(); foreach (sentry::findallgroups() $groupobj) { $groups[$groupobj->id] = $groupobj->name; } // check if user in administrator group // if ($user->ingroup($admin)) // { // user in administrator group return view::make('edit.users')->with('groups',$groups); // } // else // { // // user not in administrator group // return view::make('layout'); // } // } // catch (cartalyst\sentry\users\usernotfoundexception $e) // { // echo 'user not found.'; // } // catch (cartalyst\sentry\groups\groupnotfoundexception $e) // { // echo 'group not found.'; // } }
commented lines tried comment , uncomment without difference.
here routes.php
:
route::group(array('before'=>'auth'),function() { route::resource('admin', 'usercontroller'); route::resource('admin/typ', 'typecontroller'); route::resource('admin/cat', 'categorycontroller'); route::resource('admin/group', 'groupcontroller'); route::get('logout', 'homecontroller@logout'); }); route::get('register', 'homecontroller@getregister'); route::get('login', 'homecontroller@getlogin'); route::post('login', 'homecontroller@postlogin'); route::post('register', 'usercontroller@store');
Comments
Post a Comment