Problems with destroy() Method in Laravel Backpack





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0















I'm having problems overriding the destroy() method in Laravel Backpack. When I try to do more, like calling an external method using cURL to an API inside the destroy() method of my entityCRUD, it stops working (and there are no errors returned).



<?php

public function destroy($id)
{
$this->crud->hasAccessOrFail('delete');

$customer = Customer::find($id);
$array_api_user_options = AdminUserJsonRepositoryData::deleteArrayData();
$array_api_user_options['mail'] = $customer->email;
$array_api_user_options['ke'] = $customer->api_group_key;
$array_api_user_options['uid'] = $customer->api_user_id;

// Instancia o Shinobi com token e group key
$apiShinobi = New ShinobiAPIRepositoryAPI($customer->api_auth_token, $customer->group_key, $customer->user_id);
$apiShinobi->deleteAdminUser(json_encode($array_api_user_options));

return $this->crud->delete($id);
}


When I remove the line: $apiShinobi->deleteAdminUser() it works again and deletes my record. Can someone help me out, please?










share|improve this question































    0















    I'm having problems overriding the destroy() method in Laravel Backpack. When I try to do more, like calling an external method using cURL to an API inside the destroy() method of my entityCRUD, it stops working (and there are no errors returned).



    <?php

    public function destroy($id)
    {
    $this->crud->hasAccessOrFail('delete');

    $customer = Customer::find($id);
    $array_api_user_options = AdminUserJsonRepositoryData::deleteArrayData();
    $array_api_user_options['mail'] = $customer->email;
    $array_api_user_options['ke'] = $customer->api_group_key;
    $array_api_user_options['uid'] = $customer->api_user_id;

    // Instancia o Shinobi com token e group key
    $apiShinobi = New ShinobiAPIRepositoryAPI($customer->api_auth_token, $customer->group_key, $customer->user_id);
    $apiShinobi->deleteAdminUser(json_encode($array_api_user_options));

    return $this->crud->delete($id);
    }


    When I remove the line: $apiShinobi->deleteAdminUser() it works again and deletes my record. Can someone help me out, please?










    share|improve this question



























      0












      0








      0








      I'm having problems overriding the destroy() method in Laravel Backpack. When I try to do more, like calling an external method using cURL to an API inside the destroy() method of my entityCRUD, it stops working (and there are no errors returned).



      <?php

      public function destroy($id)
      {
      $this->crud->hasAccessOrFail('delete');

      $customer = Customer::find($id);
      $array_api_user_options = AdminUserJsonRepositoryData::deleteArrayData();
      $array_api_user_options['mail'] = $customer->email;
      $array_api_user_options['ke'] = $customer->api_group_key;
      $array_api_user_options['uid'] = $customer->api_user_id;

      // Instancia o Shinobi com token e group key
      $apiShinobi = New ShinobiAPIRepositoryAPI($customer->api_auth_token, $customer->group_key, $customer->user_id);
      $apiShinobi->deleteAdminUser(json_encode($array_api_user_options));

      return $this->crud->delete($id);
      }


      When I remove the line: $apiShinobi->deleteAdminUser() it works again and deletes my record. Can someone help me out, please?










      share|improve this question
















      I'm having problems overriding the destroy() method in Laravel Backpack. When I try to do more, like calling an external method using cURL to an API inside the destroy() method of my entityCRUD, it stops working (and there are no errors returned).



      <?php

      public function destroy($id)
      {
      $this->crud->hasAccessOrFail('delete');

      $customer = Customer::find($id);
      $array_api_user_options = AdminUserJsonRepositoryData::deleteArrayData();
      $array_api_user_options['mail'] = $customer->email;
      $array_api_user_options['ke'] = $customer->api_group_key;
      $array_api_user_options['uid'] = $customer->api_user_id;

      // Instancia o Shinobi com token e group key
      $apiShinobi = New ShinobiAPIRepositoryAPI($customer->api_auth_token, $customer->group_key, $customer->user_id);
      $apiShinobi->deleteAdminUser(json_encode($array_api_user_options));

      return $this->crud->delete($id);
      }


      When I remove the line: $apiShinobi->deleteAdminUser() it works again and deletes my record. Can someone help me out, please?







      laravel curl laravel-5 backpack-for-laravel






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 27 '18 at 6:29









      Karl Hill

      3,50132446




      3,50132446










      asked Nov 27 '18 at 1:12









      Guilherme SchmidtGuilherme Schmidt

      61




      61
























          1 Answer
          1






          active

          oldest

          votes


















          0














          If it work without that line, the problem is definitely with that line :-)



          In Chrome Developer Tools, the Network tab, you should be able to see the result of your AJAX request - and the error you're getting:



          enter image description here






          share|improve this answer
























          • Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

            – Guilherme Schmidt
            Dec 3 '18 at 14:49











          • I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

            – tabacitu
            Dec 5 '18 at 7:43






          • 1





            OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

            – Guilherme Schmidt
            Dec 5 '18 at 11:17











          • Glad to help! :-)

            – tabacitu
            Dec 6 '18 at 8:13












          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53491399%2fproblems-with-destroy-method-in-laravel-backpack%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If it work without that line, the problem is definitely with that line :-)



          In Chrome Developer Tools, the Network tab, you should be able to see the result of your AJAX request - and the error you're getting:



          enter image description here






          share|improve this answer
























          • Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

            – Guilherme Schmidt
            Dec 3 '18 at 14:49











          • I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

            – tabacitu
            Dec 5 '18 at 7:43






          • 1





            OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

            – Guilherme Schmidt
            Dec 5 '18 at 11:17











          • Glad to help! :-)

            – tabacitu
            Dec 6 '18 at 8:13
















          0














          If it work without that line, the problem is definitely with that line :-)



          In Chrome Developer Tools, the Network tab, you should be able to see the result of your AJAX request - and the error you're getting:



          enter image description here






          share|improve this answer
























          • Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

            – Guilherme Schmidt
            Dec 3 '18 at 14:49











          • I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

            – tabacitu
            Dec 5 '18 at 7:43






          • 1





            OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

            – Guilherme Schmidt
            Dec 5 '18 at 11:17











          • Glad to help! :-)

            – tabacitu
            Dec 6 '18 at 8:13














          0












          0








          0







          If it work without that line, the problem is definitely with that line :-)



          In Chrome Developer Tools, the Network tab, you should be able to see the result of your AJAX request - and the error you're getting:



          enter image description here






          share|improve this answer













          If it work without that line, the problem is definitely with that line :-)



          In Chrome Developer Tools, the Network tab, you should be able to see the result of your AJAX request - and the error you're getting:



          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 1 '18 at 8:48









          tabacitutabacitu

          2,14511525




          2,14511525













          • Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

            – Guilherme Schmidt
            Dec 3 '18 at 14:49











          • I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

            – tabacitu
            Dec 5 '18 at 7:43






          • 1





            OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

            – Guilherme Schmidt
            Dec 5 '18 at 11:17











          • Glad to help! :-)

            – tabacitu
            Dec 6 '18 at 8:13



















          • Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

            – Guilherme Schmidt
            Dec 3 '18 at 14:49











          • I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

            – tabacitu
            Dec 5 '18 at 7:43






          • 1





            OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

            – Guilherme Schmidt
            Dec 5 '18 at 11:17











          • Glad to help! :-)

            – tabacitu
            Dec 6 '18 at 8:13

















          Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

          – Guilherme Schmidt
          Dec 3 '18 at 14:49





          Tabacitu, It tooks 2 minutes to process it, and returns no erros, only the value 1. It removes the user, but do not runned ok the line that calls the curl api. but when I run the api in another method, like the store, it works well.

          – Guilherme Schmidt
          Dec 3 '18 at 14:49













          I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

          – tabacitu
          Dec 5 '18 at 7:43





          I understand. Returning "1" is perfectly fine. If it's taking too long, it's definitely because of the CURL call - try to optimize that. An option would be to do it async, not waiting for the CURL reply. But of course, if it fails the user would have no feedback on it...

          – tabacitu
          Dec 5 '18 at 7:43




          1




          1





          OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

          – Guilherme Schmidt
          Dec 5 '18 at 11:17





          OK, iam going deeper now and found another problems, I tried the custom button and it helps me also to understand more things. Now its working againg with the destroy method. thanks a lot and sorry!

          – Guilherme Schmidt
          Dec 5 '18 at 11:17













          Glad to help! :-)

          – tabacitu
          Dec 6 '18 at 8:13





          Glad to help! :-)

          – tabacitu
          Dec 6 '18 at 8:13




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53491399%2fproblems-with-destroy-method-in-laravel-backpack%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Tonle Sap (See)

          I get strange results when I access the Sqlitedatabase with Unity C# via XAMPP

          Guatemaltekische Davis-Cup-Mannschaft