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;
}
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
add a comment |
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
add a comment |
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
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
laravel curl laravel-5 backpack-for-laravel
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
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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:

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
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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:

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
add a comment |
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:

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
add a comment |
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:

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:

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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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