app/Http/Controllers/UserController.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)
    {
        $input = json_decode($request->getContent(), true);
        $user = new User();
        $user->setName($input['name']);
        $user->setBorn($input['born']);
        $this->entityManager->persist($user);
        $this->entityManager->flush();
        return (new Response())->setContent($user->getId());
    }
public function store ( Request $ request ) { $ input = json_decode ( $ request -> getContent ( ) , true ) ; $ user = new User ( ) ; $ user -> setName ( $ input [ 'name' ] ) ; $ user -> setBorn ( $ input [ 'born' ] ) ; $ this -> entityManager -> persist ( $ user ) ; $ this -> entityManager -> flush ( ) ; return ( new Response ( ) ) -> setContent ( $ user -> getId ( ) ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .