app/Http/Controllers/UsuarioController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $this->validate($request, [
            'name' => 'required',
            'email' => 'required|email|unique:users,email',
            'password' => 'required|same:confirm-password',
            'roles' => 'required'
        ]);
        $input = $request->all();
        $input['password'] = Hash::make($input['password']);
        $user = User::create($input);
        $user->assignRole($request->input('roles'));
        return redirect()->route('usuarios.index');
    }
public function store ( Request $ request ) { $ this -> validate ( $ request , [ 'name' => 'required' , 'email' => 'required|email|unique:users,email' , 'password' => 'required|same:confirm-password' , 'roles' => 'required' ] ) ; $ input = $ request -> all ( ) ; $ input [ 'password' ] = Hash :: make ( $ input [ 'password' ] ) ; $ user = User :: create ( $ input ) ; $ user -> assignRole ( $ request -> input ( 'roles' ) ) ; return redirect ( ) -> route ( 'usuarios.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .