Angular passing params to Laravel to edit

I am using laravel 5.1, how can the request accept an id passing by angular via an api call? Here is my code.

angular.module('MyApp')
    .factory('Account', function($http){
        return {
getProductToEdit: function(pid){
                //console.log(pid) ----> return 16
                return $http.get('/api/productedit',pid);
            }
    }   
    });

My backed function:

public function updateProductAPI(Request $request)
    {
         $prodId = $request->all(); ---> return []
         // $request->input('pid'); ---> Object {}

         return response()->json($prodId);
    }

Thanks!!


Source: laravel

Leave a Reply