php - Registered user data is not saved to database. Laravel 5.2 -


i tried implement role base authentication. authentication done correctly. if user admin can register new employee. matter data put registration form not saved database. route redirections correct data not saved. using builtin auth system of laravel 5.2.

route:: get('/register',['middleware'=> 'roles', function(){      return view('auth.register'); }]); 

middleware:

public function handle($request, closure $next)     {         if ($request->user()==null)         {             return redirect('/login');          }          if (!$request->user()->isadmin()){             return redirect('books');         }          return $next($request);      } } 

user model:

  public function roles(){         return $this->belongstomany('app\role','roles_users', 'user_id', 'role_id');     }     public function isadmin() {         return in_array(2, $this->roles()->pluck('role_id')->all());     } 

if remove middleware registered data saved properly.

i solved problem. in built in authcontroller there constructor predefined middleware. deleted it. code works wanted.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -