app/Http/Controllers/Admin/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)
    {
        $dados = $request->all();
        $validacao = Validator::make($dados, [
            'name' => 'required|string|max:255',
            'email' => 'required|string|email|max:255|unique:users',
            'password' => 'required|string|min:6|',
        ]);
        if($validacao->fails()){
            return redirect()
                ->back()
                ->withErrors($validacao)
                ->withInput();
        }
        $dados['password'] = Hash::make($dados['password']);
        User::create($dados);
        return redirect()->back();
    }
public function store ( Request $ request ) { $ dados = $ request -> all ( ) ; $ validacao = Validator :: make ( $ dados , [ 'name' => 'required|string|max:255' , 'email' => 'required|string|email|max:255|unique:users' , 'password' => 'required|string|min:6|' , ] ) ; if ( $ validacao -> fails ( ) ) { return redirect ( ) -> back ( ) -> withErrors ( $ validacao ) -> withInput ( ) ; } $ dados [ 'password' ] = Hash :: make ( $ dados [ 'password' ] ) ; User :: create ( $ dados ) ; return redirect ( ) -> back ( ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .