app/Http/Controllers/ProductController.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)
    {
        $product = new Product;
        $product->name = $request->get('name');
        $product = $this->productRepository->save($product);
        return response()->json($product);
    }
public function store ( Request $ request ) { $ product = new Product ; $ product -> name = $ request -> get ( 'name' ) ; $ product = $ this -> productRepository -> save ( $ product ) ; return response ( ) -> json ( $ product ) ; }
Store a newly created resource in storage.
Store a newly created resource in storage .