内部服务器错误(500)

Having issue with this

if(attributeName == 'id'){
    var id = dataValue;

    $("#discard").click(function(){
        alert(id);

        $.ajax({
            url: 'deleteob/' + id
        });

    });
}

I have this route in web.php

Route::get('/deleteob/{id}', 'RequestsController@deleteOBRequest');

Then this is my controller

  public function deleteOBRequest($id){

    $masterIds = OBMaster::findOrFail($id);
    $detailIds =  OBRequest::where('details_id', $masterIds->id);

    $masterIds->destroy();
    $detailIds->destroy();

    return redirect('OB_ViewDetails');
  }

My problem is there's is a internal server error (500). i'm new in laravel. Hope someone can give me some ideas.

you have to use

$masterIds->delete();
$detailIds->delete();

instead of

$masterIds->destroy();
$detailIds->destroy();