marcellopato

marcellopato

Member Since 2 Years Ago

São Paulo

CEO at AHCME

Experience Points 22,570
Experience Level 5

2,430 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed 190
Lessons
Completed
Best Reply Awards 0
Best Reply
Awards
  • start-engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

19 Aug
23 hours ago

marcellopato started a new conversation Download Is Not Working On Server

Hello everyone!

I have this download section on my site and it is working just fine on my local dev MacBook, but when I deployed to the aws Ubuntu server, then redirects to a white page, with no errors and don´t download the file.

What could it be?

Let´s see some code:

        if ($vence == 8) {
            $file = storage_path() . "/app/public/calendario/vence_" . $vence . ".ics";
            $headers = array(
                'Content-Type: application/ics',
            );
            if ($idERP == 1) {
                $baixou = new Calendario();
                $baixou->grupo = $str;
                $baixou->cota = $cota;
                $baixou->save();
            }
            if ($idERP == 2) {
                $baixou = new Calendario();
                $baixou->grupo = $grupo;
                $baixou->cota = $cota;
                $baixou->save();
            }
            return Response::download($file, 'primorossi.ics', $headers);
        }

Routes:

Route::get('calendarios/{calendarios}', '[email protected]')->name('calendarios');
Route::get('baixaCalendario/{grupo}/{cota}', '[email protected]')->name('baixaCalendario');

View blade:

@foreach($calendarios as $calendario)
                                <a href="{{ route('baixaCalendario', [$calendario->grupo, $calendario->cota]) }}" class="list-group-item list-group-item-action" @click="loading"> {{ $calendario->cota }} <small class="float-right">clique uma vez e aguarde o início do download</small></a>
                            @endforeach```
14 Aug
5 days ago

marcellopato left a reply on Can Figure Why

Solved in another way. The call to the WS was on a page that calls this function above. So I cut the call from there and pasted above of this function and now it is working like a breeze.

Anyways it is good to talk about your code with someone. Thanks dude!

marcellopato left a reply on Can Figure Why

Not yet. Good idea, let me try it and will right back

marcellopato left a reply on Can Figure Why

I´ve changed to `$consorciado[0][NOME-CLIENTE and got this error:

Cannot use object of type stdClass as array

marcellopato started a new conversation Can Figure Why

I am working with WS to get some data. Sometimes the data comes as an array, sometimes as an object, or collection. So far, so good. Let´s talk about arrays:

The code works like a breeze with an array but doesn´t work with another. The problem is that both are likewise, identical, with same positions, etc.

Let´s see some code:

static function multicota($cpfCnpjHigienizado, $consorciado, $novoConsorciado, $erp, $password)
    {
        $url = env('URL_WS');
        $gravaNomeConsorciado = User::where('cpfCnpj', '=', $cpfCnpjHigienizado)->first();
        $gravaNomeConsorciado->name = $consorciado[0]->{'NOME-CLIENTE'};
        $gravaNomeConsorciado->save();
        foreach ($consorciado as $c) { //pega cada cota e grava
            $contrato = Contrato::where('contrato', '=', $c->{'NUMERO-CONTRATO'})->get();
            if ($contrato->IsEmpty()) {
                $contrato = new Contrato();
                $contrato->user_id = $novoConsorciado->id;
                $contrato->pessoa = $c->{'CODIGO-TIPO-PESSOA'};
                $contrato->contrato = $c->{'NUMERO-CONTRATO'};
                $contrato->grupo = $c->{'CODIGO-GRUPO'};
                $contrato->cota = $c->{'NUMERO-COTA'};
                $contrato->descricao = $c->{'DESCRICAO-BEM'};
                $contrato->valor = $c->{'VALOR-BEM'};
                if ($c->{'DATA-ENTREGA'} == '') {
                    $contrato->data_entrega = '1970-01-01 00:00:01.0';
                } else {
                    $contrato->data_entrega = $c->{'DATA-ENTREGA'};
                }
                if ($c->{'DATA-CONTEMPLACAO'} == '') { //Se não foi contemplado, redireciona pra home
                    $contrato->data_contemplacao = '1970-01-01 00:00:01.0';
                    // return redirect(route('home'));
                } else {
                    $contrato->data_contemplacao = $c->{'DATA-CONTEMPLACAO'};
                }
                $contrato->cep = $c->{'CEP'};
                $contrato->originalSegmento = $c->{'CODIGO-GRUPO'};

                $contrato->save();
            }
        }

        $grupoEcota = new \SoapClient($url);
        $paramExtrato = array(
            'sGrupo' => $consorciado[0]->{'CODIGO-GRUPO'},
            'iCota' => $consorciado[0]->{'NUMERO-COTA'},
            'iIdERP' => $erp,
        );
        $responseExtrato = $grupoEcota->ROS_ExtratoContaCorrente($paramExtrato);
        $grupoEcota = $responseExtrato->ExtratoContaCorrente;
        $contemplado = User::where('cpfCnpj', '=', $cpfCnpjHigienizado)->first();
        if (!$contemplado) {
            $contemplado = new User();
            $contemplado->name = $grupoEcota->{'NOME-CLIENTE'};
            $contemplado->cpfCnpj = $cpfCnpjHigienizado;
            $contemplado->password = bcrypt($password);
            $contemplado->idERP = $erp;
            $contemplado->save();
        }

        $endereco = Endereco::where('user_id', '=',  $contemplado->id)->first();
        if (!$endereco) {
            $endereco = new Endereco();
            $endereco->user_id = $contemplado->id;
            $endereco->logradouro = $grupoEcota->{'NOME-LOGRADOURO'};
            $endereco->numero = $grupoEcota->{'NUMERO-LOGRADOURO'};
            $endereco->bairro = $grupoEcota->{'BAIRRO'};
            $endereco->municipio = $grupoEcota->{'CIDADE'};
            $endereco->uf = $grupoEcota->{'UF'};
            $endereco->cep = $grupoEcota->{'CEP'};
            $endereco->telefone = $grupoEcota->{'NUMERO-TELEFONE'};
            $endereco->save();
        }
    }

That´s is the array that doesn´t work:

array:4 [▼
  0 => {#678 ▼
    +"CODIGO-TIPO-PESSOA": "J"
    +"CPF-CNPJ": "00635344000177"
    +"CODIGO-GRUPO": "07384"
    +"NUMERO-SEQUENCIA": 0
    +"NUMERO-COTA": 853
    +"NOME-CLIENTE": "AUTO ESCOLA GUILHERMITTI E L LTDA"
    +"NUMERO-CONTRATO": 859866
    +"DESCRICAO-BEM": "HONDA NXR 160 BROS"
    +"VALOR-BEM": 12975.0
    +"NUMERO-TELEFONE": "017 32581859"
    +"DATA-PROXIMA-REUNIAO": "20190624"
    +"SITUACAO-COBRANCA": "Q"
    +"DESCRICAO-SITUACAO-COBRANCA": "Quitação"
    +"FASE-SITUACAO-COBRANCA": "Q000"
    +"CODIGO-PLANO-COTA": 31
    +"DATA-ENTREGA": "20180507"
    +"DATA-CONTEMPLACAO": "20170622"
    +"PERC-TOTAL-PAGO": 100.0009
    +"PERC-TOTAL-PENDENTE": 0.0
    +"PERC-QUITACAO": -0.0009
    +"CODIGO-FORMA-PAGAMENTO": 1
    +"DATA-NASCIMENTO": ""
    +"DATA-CANCELAMENTO": ""
    +"CADASTRO-ATUALIZADO": "N"
    +"SEGMENTO-CADOC": 4
    +"CEP": 15115000
  }
  1 => {#677 ▶}
  2 => {#684 ▶}
  3 => {#687 ▶}
]

And this is the one that works:

array:3 [▼
  0 => {#678 ▼
    +"CODIGO-TIPO-PESSOA": "J"
    +"CPF-CNPJ": "61181558000105"
    +"CODIGO-GRUPO": "1103"
    +"NUMERO-SEQUENCIA": 0
    +"NUMERO-COTA": 127
    +"NOME-CLIENTE": "ESCOLA DO MOVIMENTO IVALDO BERTAZZO"
    +"NUMERO-CONTRATO": 12032
    +"DESCRICAO-BEM": "9130"
    +"VALOR-BEM": 389933.0
    +"NUMERO-TELEFONE": ""
    +"DATA-PROXIMA-REUNIAO": "20190823"
    +"SITUACAO-COBRANCA": "N"
    +"DESCRICAO-SITUACAO-COBRANCA": "Normal"
    +"FASE-SITUACAO-COBRANCA": "N000"
    +"CODIGO-PLANO-COTA": 0
    +"DATA-ENTREGA": ""
    +"DATA-CONTEMPLACAO": "20190625"
    +"PERC-TOTAL-PAGO": 4.899
    +"PERC-TOTAL-PENDENTE": 93.4892
    +"PERC-QUITACAO": 95.101
    +"CODIGO-FORMA-PAGAMENTO": 1
    +"DATA-NASCIMENTO": "19890718"
    +"DATA-CANCELAMENTO": ""
    +"CADASTRO-ATUALIZADO": ""
    +"SEGMENTO-CADOC": 0
    +"CEP": 5021000
  }
  1 => {#677 ▶}
  2 => {#684 ▶}
]

As you can see, both are identical, but it works only with the second one. What I am missing? Why is that?

Thanks in advance!

EDIT: Actually now both aren´t working. How it is possible?

13 Aug
6 days ago

marcellopato left a reply on How To Fill This Array?

SOLVED! I would never find that little detail could be the problem. Thanks, @robstar !

marcellopato started a new conversation How To Fill This Array?

I have this v-for:

<li v-for="(socio, index) in socios" class="list-group-item">
                            <div class="row">
                                <div class="col-sm-6">
                                    <label>Nome</label>
                                    <input type="text" name="socios[][nome]" class="form-control" disabled
                                        :placeholder="socio.nome + ' - ' + socio.qual" :value="socio.nome + ' - ' + socio.qual" v-model="socio.nome">
                                </div>
                                <div class="col-sm-2">
                                    <label>C.P.F.</label>
                                    <input type="text" name="socios[][cpf]" class="form-control" placeholder="###.###.###-##" v-mask="'###.###.###-##'">
                                </div>
                                <div class="col-sm-2">
                                    <label>R.G.</label>
                                    <input type="text" name="socios[][rg]" class="form-control" placeholder="##.###.###-#" v-mask="'##.###.###-#'">
                                </div>
                                <div class="col-sm-2">
                                    <label>Órgão Exp.</label>
                                    <input type="text" name="socios[][orgaoExp]" class="form-control">
                                </div>
                            </div>
                        </li>

This first input fills on the fly, cause the data came from a response. The others, like: 'cpf', 'rg' and 'orgaoExp' must be filled by the user.

When sending the form I got this print:

"socios": [
{
"cpf": "132.555.555-55"
},
{
"rg": "55.555.555-5"
},
{
"orgaoExp": "SSP"
},
{
"cpf": "987.986.546-53"
},
{
"rg": "98.765.465-1"
},
{
"orgaoExp": "SSP"
}
],

As you can see, the field 'nome' doesn't appears in the 'socios' array. How do I can do it?

Please!

06 Aug
1 week ago

marcellopato left a reply on Multiauth

I´ll change my optic about it. A user is a user and must be recorded at users table. What users must have that differs from others is a role.

marcellopato started a new conversation Multiauth

I am building an app and will need multi auth to works well. First, users that will log as employees using table users with email and password. I´m using Voyager as backend and using roles and permissions. So far, so good. Now I have another kind of user: they are registered on an ERP and I reach then via WS using CPF (like the social-secure number) and password stored in ERP. Then I get then and record at a table all the data I need. It is working well as good. Well, was working. For those users, I used the API route, just not to make a mess on my web routes file. Yesterday I ran PHP artisan make:auth and that´s when things start to get crazy.

Every axios call now returns me an 'unauthorized' message cause, obviously, they´re not authenticated.

What would be better?

  • Refactory Users login to use CPF instead of email and give a new role for those others API guys and make then pass trough web.php file like everybody?
  • Use a multiauth package?
  • Or anything else?

Please, help!

02 Aug
2 weeks ago

marcellopato left a reply on Call To Undefined Function App\Http\Controllers\curl_init()

All right. Now it is working. I realised that my server had PHP 7.2 and 7.3 at same time. Uninstall both and reinstalled 7.3. Now is working like a breeze! Thank You all!

marcellopato left a reply on Call To Undefined Function App\Http\Controllers\curl_init()

@cronix , you´re right. But I think this is not the problem though. Still working and I´ll let you guys know

marcellopato left a reply on Call To Undefined Function App\Http\Controllers\curl_init()

Thanks, @thureos , It is working now. I realized that I was PHP 7.2 and PHP 7.3 installed at the same time. So I uninstalled both and reinstalled only 7.3

marcellopato left a reply on Call To Undefined Function App\Http\Controllers\curl_init()

It works perfectly on my dev computer. Can´t be syntax error...

marcellopato left a reply on Call To Undefined Function App\Http\Controllers\curl_init()

It appears only at PHP Credits section

marcellopato started a new conversation Call To Undefined Function App\Http\Controllers\curl_init()

Hi guys! I have just deployed my Laravel app to aws ubuntu 18, php7.3, apache2, MySQL8, cURL 7.58.0 and don´t know why it is not working. The error is on this post title. It works just fine at my dev mac. I have done everything I found on Google and nothing seems to resolve this issue. Any helps, please?

01 Aug
2 weeks ago

marcellopato left a reply on HEAD Is Way Ahead Master

None of your assistance has brought a positive result. I am really making a mess here... :-(

marcellopato left a reply on HEAD Is Way Ahead Master

Never mind, I used a backup

marcellopato left a reply on HEAD Is Way Ahead Master

Thighs got worst. How do I get back to this commit? commit 4e51527c0e174fdc2427a9440be5d548c23c4310 (HEAD, master)

I did: git checkout commit 4e51527c0e174fdc2427a9440be5d548c23c4310, but it is not working!

marcellopato left a reply on HEAD Is Way Ahead Master

I wrote git status at Terminal and got:

git status
HEAD detached at 4e51527
nothing to commit, working tree clean

marcellopato left a reply on HEAD Is Way Ahead Master

It looks like:

|HEAD
|some commit
|some commit
|some commit
| |origin/master master
| |some commit
| |some commit
|/
some others commit...

I hope it makes things more clear

marcellopato started a new conversation HEAD Is Way Ahead Master

Don´t know if it is an Off-Topic, but I need help with Git. My HEAD is way ahead of master. HEAD has the right code and MASTER don´t. Can´t update BitBuckect repository cause it is different. It looks like:

|HEAD |some commit |some commit |some commit | |origin/master master | |some commit | |some commit |/ some others commit...

How do I make my origin/master updates to HEAD witch has the right and new code?

Thanks

05 Jul
1 month ago

marcellopato left a reply on How To Handle This?

Thank´s @s.spaan . I´ve learned a LOT with your help!

marcellopato left a reply on How To Handle This?

...and doing this

dd($firstRecord->{'DATA-VENCIMENTO'});

I got "20170818" which is the value I'm looking into. I think it solves the problem! Thanks, dude, you are the man!

marcellopato left a reply on How To Handle This?

Well, I saw that I can do like this also:

$firstRecord = collect($dados[0]->{'PARCELA-PAGA'})->firstWhere('DATA-VENCIMENTO');

        dd($firstRecord);

...and got the same result as the result above

marcellopato left a reply on How To Handle This?

It returns:

{#783 ▼
  +"NUMERO-PARCELA": 48
  +"DATA-VENCIMENTO": "20170818"
  +"DATA-PAGAMENTO": "20170919"
  +"VALOR-PARCELA": 580.28
  +"HITORICO-PARCELA": ""
  +"PERC-PAGO": 3.491
}

But let me explain better... I need to catch the value of 'DATA-VENCIMENTO', cause each one has different type has an action to do. There is a range of five 'DATA-VENCIMENTO' for each user. So I need to discover the 'DATA-VENCIMENTO' value, got it?

marcellopato left a reply on How To Handle This?

Collection {#786 ▼
  #items: array:21 [▼
    0 => {#783 ▼
      +"NUMERO-PARCELA": 48
      +"DATA-VENCIMENTO": "20170818"
      +"DATA-PAGAMENTO": "20170919"
      +"VALOR-PARCELA": 580.28
      +"HITORICO-PARCELA": ""
      +"PERC-PAGO": 3.491
    }
    1 => {#771 ▶}
    2 => {#781 ▶}
    3 => {#780 ▶}
    4 => {#779 ▶}
    5 => {#778 ▶}
    6 => {#777 ▶}
    7 => {#776 ▶}
    8 => {#775 ▶}
    9 => {#774 ▶}
    10 => {#773 ▶}
    11 => {#772 ▶}
    12 => {#757 ▶}
    13 => {#770 ▶}
    14 => {#769 ▶}
    15 => {#768 ▶}
    16 => {#767 ▶}
    17 => {#766 ▶}
    18 => {#765 ▶}
    19 => {#764 ▶}
    20 => {#763 ▶}
  ]
}

marcellopato left a reply on How To Handle This?

It returns

null

In fact, I don´t know the value of 'DATA-VENCIMENTO', cause everyone has it´s own. Maybe I use like:

$firstRecord = collect($dados[0]->{'PARCELA-PAGA'})->first(['DATA-VENCIMENTO']);

What do you think?

04 Jul
1 month ago

marcellopato left a reply on How To Handle This?

Could you, please, show me where to write your code in my code?

marcellopato left a reply on How To Handle This?

I think will be better if I show more code:

$url = 'http://*.*.*.*/SomeServices.asmx?WSDL';
        $idERP = 1;
        $grupoEcota = new \SoapClient($url);
        $paramExtrato = array(
            'sGrupo' => $request->sGrupo,
            'iCota' => $request->iCota,
            'iIdERP' => $idERP,
        );
        $responseExtrato = $grupoEcota->ROS_ExtratoContaCorrente($paramExtrato);
        $grupoEcota = $responseExtrato->ExtratoContaCorrente;
    $dados[] = $grupoEcota->{'PARCELAS-PAGAS'};
        dd($dados);

The response is the array above!

marcellopato started a new conversation How To Handle This?

I get a response from a WS witch looks like this from dd(die and dump):

array:1 [▼
  0 => {#784 ▼
    +"PARCELA-PAGA": array:21 [▼
      0 => {#783 ▼
        +"NUMERO-PARCELA": 48
        +"DATA-VENCIMENTO": "20170818"
        +"DATA-PAGAMENTO": "20170919"
        +"VALOR-PARCELA": 580.28
        +"HITORICO-PARCELA": ""
        +"PERC-PAGO": 3.491
      }
      1 => {#771 ▶}
      2 => {#781 ▶}
      3 => {#780 ▶}
      4 => {#779 ▶}
      5 => {#778 ▶}
      6 => {#777 ▶}
      7 => {#776 ▶}
      8 => {#775 ▶}
      9 => {#774 ▶}
      10 => {#773 ▶}
      11 => {#772 ▶}
      12 => {#757 ▶}
      13 => {#770 ▶}
      14 => {#769 ▶}
      15 => {#768 ▶}
      16 => {#767 ▶}
      17 => {#766 ▶}
      18 => {#765 ▶}
      19 => {#764 ▶}
      20 => {#763 ▶}
    ]
  }
]

I need to get only the first "DATA-VENCIMENTO": "20170818" item. How do I do it, please?

13 Jun
2 months ago

marcellopato left a reply on Guzzle API Response

@JOHNBRAUN - No problem John, I can say nothing but thanks! I´ve changed my mind and now I´m doing an AJAX request via AXIOS and it is working. Sorry to bother and thanks a lot for your help!

marcellopato left a reply on Guzzle API Response

@JOHNBRAUN - Going crazy already...

Call to a member function toArray() on array

marcellopato left a reply on Guzzle API Response

@JOHNBRAUN - In PHP and Vue:

Cannot access protected property Illuminate\Http\JsonResponse::$data (View: /Users/marcellopato/Sites/primorossi/resources/views/contemplado/pessoaJ.blade.php)

marcellopato left a reply on Guzzle API Response

@JOHNBRAUN - var_dump gives me:

object(Illuminate\Http\JsonResponse)#820 (11) { ["data":protected]=> string(1248) "{"atividade_principal":[{"text":"Forma\u00e7\u00e3o de condutores","code":"85.99-6-01"}],"data_situacao":"25\/02\/2001","nome":"AUTO ESCOLA GUILHERMITTI & LOBANCO LTDA","uf":"SP","telefone":"(17) 3258-1649 \/ (17) 3258-1649","email":"[email protected]","qsa":[{"qual":"49-S\u00f3cio-Administrador","nome":"ELIANA CRISTINA GUILHERMITTI RODRIGUES"},{"qual":"49-S\u00f3cio-Administrador","nome":"SUZANA MARQUES LOBANCO"},{"qual":"49-S\u00f3cio-Administrador","nome":"AMARILDO APARECIDO RODRIGUES"},{"qual":"22-S\u00f3cio","nome":"VALDEMIR FRANCISCO DA COSTA"},{"qual":"49-S\u00f3cio-Administrador","nome":"ANDRE LUIS LOBANCO"}],"situacao":"ATIVA","bairro":"CENTRO","logradouro":"R CASTRO ALVES","numero":"1408","cep":"15.115-000","municipio":"BADY BASSITT","porte":"MICRO EMPRESA","abertura":"02\/06\/1995","natureza_juridica":"206-2 - Sociedade Empres\u00e1ria Limitada","cnpj":"00.635.344\/0001-77","ultima_atualizacao":"2019-01-03T10:43:40.334Z","status":"OK","tipo":"MATRIZ","fantasia":"","complemento":"","efr":"","motivo_situacao":"","situacao_especial":"","data_situacao_especial":"","atividades_secundarias":[{"code":"00.00-0-00","text":"N\u00e3o informada"}],"capital_social":"1000.00","extra":{},"billing":{"free":true,"database":true}}" ["callback":protected]=> NULL ["encodingOptions":protected]=> int(0) ["headers"]=> object(Symfony\Component\HttpFoundation\ResponseHeaderBag)#819 (5) { ["computedCacheControl":protected]=> array(2) { ["no-cache"]=> bool(true) ["private"]=> bool(true) } ["cookies":protected]=> array(0) { } ["headerNames":protected]=> array(3) { ["cache-control"]=> string(13) "Cache-Control" ["date"]=> string(4) "Date" ["content-type"]=> string(12) "Content-Type" } ["headers":protected]=> array(3) { ["cache-control"]=> array(1) { [0]=> string(17) "no-cache, private" } ["date"]=> array(1) { [0]=> string(29) "Thu, 13 Jun 2019 16:24:27 GMT" } ["content-type"]=> array(1) { [0]=> string(16) "application/json" } } ["cacheControl":protected]=> array(0) { } } ["content":protected]=> string(1248) "{"atividade_principal":[{"text":"Forma\u00e7\u00e3o de condutores","code":"85.99-6-01"}],"data_situacao":"25\/02\/2001","nome":"AUTO ESCOLA GUILHERMITTI & LOBANCO LTDA","uf":"SP","telefone":"(17) 3258-1649 \/ (17) 3258-1649","email":"[email protected]","qsa":[{"qual":"49-S\u00f3cio-Administrador","nome":"ELIANA CRISTINA GUILHERMITTI RODRIGUES"},{"qual":"49-S\u00f3cio-Administrador","nome":"SUZANA MARQUES LOBANCO"},{"qual":"49-S\u00f3cio-Administrador","nome":"AMARILDO APARECIDO RODRIGUES"},{"qual":"22-S\u00f3cio","nome":"VALDEMIR FRANCISCO DA COSTA"},{"qual":"49-S\u00f3cio-Administrador","nome":"ANDRE LUIS LOBANCO"}],"situacao":"ATIVA","bairro":"CENTRO","logradouro":"R CASTRO ALVES","numero":"1408","cep":"15.115-000","municipio":"BADY BASSITT","porte":"MICRO EMPRESA","abertura":"02\/06\/1995","natureza_juridica":"206-2 - Sociedade Empres\u00e1ria Limitada","cnpj":"00.635.344\/0001-77","ultima_atualizacao":"2019-01-03T10:43:40.334Z","status":"OK","tipo":"MATRIZ","fantasia":"","complemento":"","efr":"","motivo_situacao":"","situacao_especial":"","data_situacao_especial":"","atividades_secundarias":[{"code":"00.00-0-00","text":"N\u00e3o informada"}],"capital_social":"1000.00","extra":{},"billing":{"free":true,"database":true}}" ["version":protected]=> string(3) "1.0" ["statusCode":protected]=> int(200) ["statusText":protected]=> string(2) "OK" ["charset":protected]=> NULL ["original"]=> object(stdClass)#792 (30) { ["atividade_principal"]=> array(1) { [0]=> object(stdClass)#790 (2) { ["text"]=> string(24) "Formação de condutores" ["code"]=> string(10) "85.99-6-01" } } ["data_situacao"]=> string(10) "25/02/2001" ["nome"]=> string(39) "AUTO ESCOLA GUILHERMITTI & LOBANCO LTDA" ["uf"]=> string(2) "SP" ["telefone"]=> string(31) "(17) 3258-1649 / (17) 3258-1649" ["email"]=> string(22) "[email protected]" ["qsa"]=> array(5) { [0]=> object(stdClass)#806 (2) { ["qual"]=> string(23) "49-Sócio-Administrador" ["nome"]=> string(38) "ELIANA CRISTINA GUILHERMITTI RODRIGUES" } [1]=> object(stdClass)#796 (2) { ["qual"]=> string(23) "49-Sócio-Administrador" ["nome"]=> string(22) "SUZANA MARQUES LOBANCO" } [2]=> object(stdClass)#802 (2) { ["qual"]=> string(23) "49-Sócio-Administrador" ["nome"]=> string(28) "AMARILDO APARECIDO RODRIGUES" } [3]=> object(stdClass)#803 (2) { ["qual"]=> string(9) "22-Sócio" ["nome"]=> string(27) "VALDEMIR FRANCISCO DA COSTA" } [4]=> object(stdClass)#805 (2) { ["qual"]=> string(23) "49-Sócio-Administrador" ["nome"]=> string(18) "ANDRE LUIS LOBANCO" } } ["situacao"]=> string(5) "ATIVA" ["bairro"]=> string(6) "CENTRO" ["logradouro"]=> string(14) "R CASTRO ALVES" ["numero"]=> string(4) "1408" ["cep"]=> string(10) "15.115-000" ["municipio"]=> string(12) "BADY BASSITT" ["porte"]=> string(13) "MICRO EMPRESA" ["abertura"]=> string(10) "02/06/1995" ["natureza_juridica"]=> string(38) "206-2 - Sociedade Empresária Limitada" ["cnpj"]=> string(18) "00.635.344/0001-77" ["ultima_atualizacao"]=> string(24) "2019-01-03T10:43:40.334Z" ["status"]=> string(2) "OK" ["tipo"]=> string(6) "MATRIZ" ["fantasia"]=> string(0) "" ["complemento"]=> string(0) "" ["efr"]=> string(0) "" ["motivo_situacao"]=> string(0) "" ["situacao_especial"]=> string(0) "" ["data_situacao_especial"]=> string(0) "" ["atividades_secundarias"]=> array(1) { [0]=> object(stdClass)#781 (2) { ["code"]=> string(10) "00.00-0-00" ["text"]=> string(14) "Não informada" } } ["capital_social"]=> string(7) "1000.00" ["extra"]=> object(stdClass)#798 (0) { } ["billing"]=> object(stdClass)#789 (2) { ["free"]=> bool(true) ["database"]=> bool(true) } } ["exception"]=> NULL }

and dd($receita):

JsonResponse {#820 ▼
  #data: "{"atividade_principal":[{"text":"Forma\u00e7\u00e3o de condutores","code":"85.99-6-01"}],"data_situacao":"25\/02\/2001","nome":"AUTO ESCOLA GUILHERMITTI & LOBANCO LTDA","uf":"SP","telefone":"(17) 3258-1649 \/ (17) 3258-1649","email":"[email protected]","qsa":[{"qual":"49-S\u00f3cio-Administrador","nome":"ELIANA CRISTINA GUILHERMITTI RODRIGUES"},{"qual":"49-S\u00f3cio-Administrador","nome":"SUZANA MARQUES LOBANCO"},{"qual":"49-S\u00f3cio-Administrador","nome":"AMARILDO APARECIDO RODRIGUES"},{"qual":"22-S\u00f3cio","nome":"VALDEMIR FRANCISCO DA COSTA"},{"qual":"49-S\u00f3cio-Administrador","nome":"ANDRE LUIS LOBANCO"}],"situacao":"ATIVA","bairro":"CENTRO","logradouro":"R CASTRO ALVES","numero":"1408","cep":"15.115-000","municipio":"BADY BASSITT","porte":"MICRO EMPRESA","abertura":"02\/06\/1995","natureza_juridica":"206-2 - Sociedade Empres\u00e1ria Limitada","cnpj":"00.635.344\/0001-77","ultima_atualizacao":"2019-01-03T10:43:40.334Z","status":"OK","tipo":"MATRIZ","fantasia":"","complemento":"","efr":"","motivo_situacao":"","situacao_especial":"","data_situacao_especial":"","atividades_secundarias":[{"code":"00.00-0-00","text":"N\u00e3o informada"}],"capital_social":"1000.00","extra":{},"billing":{"free":true,"database":true}} ◀"
  #callback: null
  #encodingOptions: 0
  +headers: ResponseHeaderBag {#819 ▶}
  #content: "{"atividade_principal":[{"text":"Forma\u00e7\u00e3o de condutores","code":"85.99-6-01"}],"data_situacao":"25\/02\/2001","nome":"AUTO ESCOLA GUILHERMITTI & LOBAN ▶"
  #version: "1.0"
  #statusCode: 200
  #statusText: "OK"
  #charset: null
  +original: {#792 ▶}
  +exception: null
}

marcellopato left a reply on Guzzle API Response

@JOHNBRAUN - In Vue there is a CORS issue. And Can´t ask the site´s owner to help me with that.

In PHP the error is:

Undefined property: Illuminate\Http\JsonResponse::$natureza_juridica

...as I already have tried.

I saw it working just fine on Laravel 5.4 and I am using 5.7. Weird hun?

marcellopato started a new conversation Guzzle API Response

Hello folks! Greetings from Brazil! I made a GET request from my model to an API endpoint like:

class CNPJ extends Model
{
    static function getCNPJ($cnpj)
    {
        $client = new Client([
            'base_uri' => 'https://www.receitaws.com.br/v1/cnpj/'
        ]);
        $response = $client->request('GET', $cnpj);
        $dadosReceita = json_decode($response->getBody()->getContents());
        return $dadosReceita;
    }
}

My controller gets the result like:

$dadosReceita = CNPJ::getCNPJ($cnpj);
            $receita =  response()->json(($dadosReceita));
            return $receita;

And the result is:


{
"atividade_principal": [
{
"text": "Formação de condutores",
"code": "85.99-6-01"
}
],
"data_situacao": "25/02/2001",
"nome": "AUTO ESCOLA GUILHERMITTI & LOBANCO LTDA",
"uf": "SP",
"telefone": "(17) 3258-1649 / (17) 3258-1649",
"email": "[email protected]",
"qsa": [
{
"qual": "49-Sócio-Administrador",
"nome": "ELIANA CRISTINA GUILHERMITTI RODRIGUES"
},
{
"qual": "49-Sócio-Administrador",
"nome": "SUZANA MARQUES LOBANCO"
},
{
"qual": "49-Sócio-Administrador",
"nome": "AMARILDO APARECIDO RODRIGUES"
},
{
"qual": "22-Sócio",
"nome": "VALDEMIR FRANCISCO DA COSTA"
},
{
"qual": "49-Sócio-Administrador",
"nome": "ANDRE LUIS LOBANCO"
}
],
"situacao": "ATIVA",
"bairro": "CENTRO",
"logradouro": "R CASTRO ALVES",
"numero": "1408",
"cep": "15.115-000",
"municipio": "BADY BASSITT",
"porte": "MICRO EMPRESA",
"abertura": "02/06/1995",
"natureza_juridica": "206-2 - Sociedade Empresária Limitada",
"cnpj": "00.635.344/0001-77",
"ultima_atualizacao": "2019-01-03T10:43:40.334Z",
"status": "OK",
"tipo": "MATRIZ",
"fantasia": "",
"complemento": "",
"efr": "",
"motivo_situacao": "",
"situacao_especial": "",
"data_situacao_especial": "",
"atividades_secundarias": [
{
"code": "00.00-0-00",
"text": "Não informada"
}
],
"capital_social": "1000.00",
"extra": {},
"billing": {
"free": true,
"database": true
}
}

I know it looks pretty easy and basic, but I can´t get 'natureza_juridica', for example. Please, can anyone help?

I must record each ´key´ to my database.

Thanks in advance

09 May
3 months ago

marcellopato left a reply on Sending File Using Guzzle

Why I´m getting this error:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Call to a member function getPath() on string

If a had Guzzle installed?

10 Apr
4 months ago

marcellopato left a reply on Check If A Driver License Is A REAL Driver License

@CRONIX - That will deal with it. Thanks a lot, you guys!

marcellopato left a reply on Check If A Driver License Is A REAL Driver License

@CRONIX - Thanks a lot! The real point is "Yes, it looks like a license". It is just to spear real people to do a visual comparison. But, that´s not an emergency, it will be a cool feature, I guess!

marcellopato left a reply on Check If A Driver License Is A REAL Driver License

@MARTINBEAN - Of course, you do, didn´t mean to be rude, sorry. Driver license is just an example, but I do need to be certain that uploaded doc is really been uploaded at the correct input field.

marcellopato left a reply on Check If A Driver License Is A REAL Driver License

@MARTINBEAN - But there´s a lot of GED that does that. And what is the difference between text data and image data? The protection should be the same. The issue is: it is possible to compare images to see if they match? With that, I´ll be able to be sure that the user is uploading a driver license at the driver license field, even though the field has an id, name, and v-model.

marcellopato left a reply on Check If A Driver License Is A REAL Driver License

@JLRDW - Cool, but maybe some library can "scan" the doc to check some patterns

09 Apr
4 months ago

marcellopato started a new conversation Check If A Driver License Is A REAL Driver License

Hello everybody! There is now a day a library to check if some image of a document is really the image of that document? I mean, if the input field is designed to upload a driver license, can I check if it is a REAL driver license, or at least, if it looks like a driver license? Let´s say I pre-scan some documents as templates, like a Brazilian drivers license and then compare it with the one the user uploads.

01 Apr
4 months ago

marcellopato left a reply on Laravel Upgrade From 5.5 To 5.6 To 5.7: Uncaught ReferenceError: Axios Is Not Defined

You know what? I´ve Git my previous version from BitBucket and done. Won´t update anymore.

30 Mar
4 months ago

marcellopato left a reply on Laravel Upgrade From 5.5 To 5.6 To 5.7: Uncaught ReferenceError: Axios Is Not Defined

@JLRDW - Cool, but didn't solve my problem. I've erased both node_modules and vendor dir, reinstalled using composer and npm, clear cache, config, and everything, but still not working. What now? Should I toss 6 months of work and use Voyager instead?

marcellopato left a reply on Laravel Upgrade From 5.5 To 5.6 To 5.7: Uncaught ReferenceError: Axios Is Not Defined

Didn't work. I think about rewriting everything using Laravel 5.7. There's must be a solution!

28 Mar
4 months ago

marcellopato left a reply on Replace '-' With '_' From A StdClass?

Thank you guys, but I made another decision!

marcellopato started a new conversation Replace '-' With '_' From A StdClass?

How do I str_replace('-', '_', $string) with this type of result?

{#591 ▼
  +"CODIGO-TIPO-PESSOA": "F"
  +"CPF-CNPJ": "76963306168"
  +"CODIGO-GRUPO": "00715"
  +"NUMERO-SEQUENCIA": 0
  +"NUMERO-COTA": 201
  +"NOME-CLIENTE": "JOEL CORAL MOISES"
  +"NUMERO-CONTRATO": 282451
  +"DESCRICAO-BEM": "IMOVEL RESIDENCIAL (715)"
  +"VALOR-BEM": 187772.0
  +"NUMERO-TELEFONE": "011 37315077"
  +"DATA-PROXIMA-REUNIAO": "20190423"
  +"SITUACAO-COBRANCA": "M"
  +"DESCRICAO-SITUACAO-COBRANCA": "Mediação"
  +"FASE-SITUACAO-COBRANCA": "M001"
  +"CODIGO-PLANO-COTA": 200
  +"DATA-ENTREGA": "20170609"
  +"DATA-CONTEMPLACAO": "20170420"
  +"PERC-TOTAL-PAGO": 70.4951
  +"PERC-TOTAL-PENDENTE": 5.7787
  +"PERC-QUITACAO": 29.5049
  +"CODIGO-FORMA-PAGAMENTO": 1
  +"DATA-NASCIMENTO": "19750805"
  +"DATA-CANCELAMENTO": ""
  +"CADASTRO-ATUALIZADO": "S"
  +"SEGMENTO-CADOC": 1
  +"CEP": 5551000
}

marcellopato left a reply on Laravel Upgrade From 5.5 To 5.6 To 5.7: Uncaught ReferenceError: Axios Is Not Defined

@RKZ - Laravel mix And I´ve changed axios versions at package.json