lundi 26 novembre 2018

Problems with destroy() Method in Laravel Backpack

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?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire