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)
    {
        $usuario = User::create($request->except(['foto']));
        if ($request->has('foto')) {
            $usuario->foto=$request->file('foto')->store('public/usuarios');
            $usuario->save();
        }
        $usuario->syncRoles($request->get('role'));
        return redirect('usuario');
    }
public function store ( Request $ request ) { $ usuario = User :: create ( $ request -> except ( [ 'foto' ] ) ) ; if ( $ request -> has ( 'foto' ) ) { $ usuario -> foto = $ request -> file ( 'foto' ) -> store ( 'public/usuarios' ) ; $ usuario -> save ( ) ; } $ usuario -> syncRoles ( $ request -> get ( 'role' ) ) ; return redirect ( 'usuario' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .