app/Http/Controllers/UsersController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  Request  $request
     * @return Response
     */
Store a newly created resource in storage.
@param  Request  $request
@return Response
Store a newly created resource in storage . @param Request $request @return Response
public function store(UserRequest $request)
    {
        $shopping_cart_id = \Session::get('shopping_cart_id');
        $user = User::where('shopping_cart_id', '=', $shopping_cart_id)->get();
        if(!count($user) == 0)
            $shopping_cart = ShoppingCart::createWithoutSession();
            else
            $shopping_cart = ShoppingCart::findBySession($shopping_cart_id);
        User::create([
            'name' => $request->name,
            'lastname' => $request->lastname,
            'shopping_cart_id' => $shopping_cart->id,
            'email' => $request->email,
            'type' => $request->type,
            'password' => bcrypt($request->password),
        ]);
        Flash::success("Se ha registrado de forma existosa");
        return redirect()->route('admin.users.index');
    }
public function store ( UserRequest $ request ) { $ shopping_cart_id = \ Session :: get ( 'shopping_cart_id' ) ; $ user = User :: where ( 'shopping_cart_id' , '=' , $ shopping_cart_id ) -> get ( ) ; if ( ! count ( $ user ) == 0 ) $ shopping_cart = ShoppingCart :: createWithoutSession ( ) ; else $ shopping_cart = ShoppingCart :: findBySession ( $ shopping_cart_id ) ; User :: create ( [ 'name' => $ request -> name , 'lastname' => $ request -> lastname , 'shopping_cart_id' => $ shopping_cart -> id , 'email' => $ request -> email , 'type' => $ request -> type , 'password' => bcrypt ( $ request -> password ) , ] ) ; Flash :: success ( " Se ha registrado de forma existosa " ) ; return redirect ( ) -> route ( 'admin.users.index' ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .
/*  if($request->type == 'member'){*/ /*  $shopping_cart = ShoppingCart::findOrCreateBySessionID($shopping_cart_id);*/ /*}else{
            dd('hola');
            $user = new User($request->all());
            $user->password = bcrypt($request->password);
            $user->save();
        }*/