Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

hamzazafeer's avatar

Laravel resource route on delete shows 403 Forbidden

My delete button

     <button class="btn btn-danger btn-xs" type="button" ng-click="removeSaleTemp(newsaletemp.id)">
            <span class="glyphicon glyphicon-trash" aria-hidden="true"></span>
        </button>

My Route

        Route::resource('api/saletemp', 'SaleTempApiController');

When i click on Delete button, it works on my localhost, but when on any hosting server (nginx). it gives me error

          403 Forbidden

I don't know why this is happening on Hosting but works on my localhost.

How can I resolve this issue ?

0 likes
3 replies
Sinnbeck's avatar

Show the removeSaleTemp() function. I assume this is javascript and ajax

hamzazafeer's avatar

@Sinnbeck

 $scope.removeSaleTemp = function(id) {
        $http.delete(site_url+'/api/saletemp/' + id).
        success(function(data, status, headers, config) {
            $http.get(site_url+'/api/saletemp').success(function(data) {
                    $scope.saletemp = data;
                    });
            });
    }
hamzazafeer's avatar
    $scope.removeSaleTemp = function(id) {
         $http.delete(site_url+'/api/saletemp/' + id).
        success(function(data, status, headers, config) {
                $http.get(site_url+'/api/saletemp').success(function(data) {
                $scope.saletemp = data;
                });
        });
}

Please or to participate in this conversation.