theblack68

Member Since 4 Years Ago

Cassano Magnago

Experience Points
20,190
Total
Experience

4,810 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
175
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your 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-in-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 Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist 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.

  • Community Pillar

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

Level 5
20,190 XP
May
04
1 week ago
Activity icon

Replied to Xml To Mysql

Thanks for help @rohit_mg ...at the moment i have resolved so:

// Prepare our stream to be read with a 1kb buffer
        $stream = new Stream\File($this->xml, 1024);

        // Construct the default parser (StringWalker)
        $parser = new Parser\StringWalker();

        // Create the streamer
        $streamer = new XmlStringStreamer($parser, $stream);

        // Rimuovo i Caratteri illegali XML
        $searches = ['', '', '', '+01:00', '+02:00'];

        // Iterate through nodes
        while ($node = str_replace($searches, '', $streamer->getNode())) {
            $row = simplexml_load_string($node);
            foreach($row->COMPONENTI_AIUTO as $key => $value) {
                foreach($value as $record) {
                    $recordXML = new Xmelle();
                    $recordXML->car = $row->CAR;
                    $recordXML->titolo_misura = $row->TITOLO_MISURA;
                    $recordXML->des_tipo_misura = $row->DES_TIPO_MISURA;
                    $recordXML->cod_ce_misura = $row->COD_CE_MISURA;
                    $recordXML->base_giuridica_nazionale = $row->BASE_GIURIDICA_NAZIONALE;
                    $recordXML->link_testo_integrale_misura = $row->LINK_TESTO_INTEGRALE_MISURA;
                    $recordXML->indentificativo_ufficio = $row->IDENTIFICATIVO_UFFICIO;
                    $recordXML->soggetto_concedente = $row->SOGGETTO_CONCEDENTE;
                    $recordXML->cor = $row->COR;
                    $recordXML->titolo_progetto = $row->TITOLO_PROGETTO;
                    $recordXML->descrizione_progetto = $row->DESCRIZIONE_PROGETTO;
                    $recordXML->link_trasparenza_nazionale = $row->LINK_TRASPARENZA_NAZIONALE;
                    $recordXML->data_concessione = $row->DATA_CONCESSIONE;
                    $recordXML->cup = $row->CUP;
                    $recordXML->atto_concessione = $row->ATTO_CONCESSIONE;
                    $recordXML->denominazione_beneficiario = $row->DENOMINAZIONE_BENEFICIARIO;
                    $recordXML->codice_fiscale_beneficiario = $row->CODICE_FISCALE_BENEFICIARIO;
                    $recordXML->des_tipo_beneficiario = $row->DES_TIPO_BENEFICIARIO;
                    $recordXML->regione_beneficiario = $row->REGIONE_BENEFICIARIO;
                    $recordXML->id_componente_aiuto = $record->ID_COMPONENTE_AIUTO;
                    $recordXML->cod_procedimento =  $record->COD_PROCEDIMENTO;
                    $recordXML->des_procedimento =  $record->DES_PROCEDIMENTO;
                    $recordXML->cod_regolamento =  $record->COD_REGOLAMENTO;
                    $recordXML->des_regolamento =  $record->DES_REGOLAMENTO;
                    $recordXML->cod_obiettivo =  $record->COD_OBIETTIVO;
                    $recordXML->des_obiettivo =  $record->DES_OBIETTIVO;
                    $recordXML->settore_attivita =  $record->SETTORE_ATTIVITA;
                    $recordXML->cod_strumento =  $record->STRUMENTI_AIUTO->STRUMENTO_AIUTO->COD_STRUMENTO;
                    $recordXML->des_strumento = $record->STRUMENTI_AIUTO->STRUMENTO_AIUTO->DES_STRUMENTO;
                    $recordXML->elemento_di_aiuto = $record->STRUMENTI_AIUTO->STRUMENTO_AIUTO->ELEMENTO_DI_AIUTO;
                    $recordXML->importo_nominale = $record->STRUMENTI_AIUTO->STRUMENTO_AIUTO->IMPORTO_NOMINALE;
                    $recordXML->save();
                }
            }
        }

What do you think about?

Apr
15
4 weeks ago
Activity icon

Started a new Conversation Xml To Mysql

Hi ...Someone che give me some help?

I have this public XML file to store in database. Until +"REGIONE_BENEFICIARIO": "Lombardia" are single field and I do without problem. From there start a depth data and I don't know ho do it.

The final goal is store, in this case, 2 distinct row with same data from +"CAR": "12627" to +"REGIONE_BENEFICIARIO": "Lombardia" and with the different from +"COMPONENTI_AIUTO" ...some advise?

I use prewk /xml-string-streamer

SimpleXMLElement {#1504 ▼
  +"CAR": "12627"
  +"TITOLO_MISURA": "COVID-19:  Fondo di garanzia PMI Aiuto di stato SA. 56966 (2020/N)"
  +"DES_TIPO_MISURA": "Regime di aiuti"
  +"COD_CE_MISURA": "SA.56966"
  +"BASE_GIURIDICA_NAZIONALE": "DECRETO-LEGGE  8 aprile 2020, n. 23   Misure urgenti in materia di accesso al credito e di adempimenti fiscali per le imprese, di poteri speciali nei settori st ▶"
  +"LINK_TESTO_INTEGRALE_MISURA": "http://www.mise.gov.it/index.php/it/incentivi/impresa/fondo-di-garanzia-per-le-pmi"
  +"IDENTIFICATIVO_UFFICIO": "1031"
  +"SOGGETTO_CONCEDENTE": "Banca del Mezzogiorno MedioCredito Centrale S.p.A."
  +"COR": "3699105"
  +"TITOLO_PROGETTO": "COVID-19: Fondo di garanzia PMI Aiuto di stato SA. 56966 (2020/N)"
  +"DESCRIZIONE_PROGETTO": "COVID-19: Fondo di garanzia PMI Aiuto di stato SA. 56966 (2020/N) - Garanzia diretta"
  +"LINK_TRASPARENZA_NAZIONALE": "https://www.fondidigaranzia.it/amministrazione-trasparente/"
  +"DATA_CONCESSIONE": "2020-12-10"
  +"CUP": "n.d."
  +"ATTO_CONCESSIONE": "LetteraEsitoRichiedente_2266268_2020-10-27.pdf"
  +"DENOMINAZIONE_BENEFICIARIO": ""VECTOR - S.P.A.""
  +"CODICE_FISCALE_BENEFICIARIO": "00698060126"
  +"DES_TIPO_BENEFICIARIO": "PMI"
  +"REGIONE_BENEFICIARIO": "Lombardia"
  +"COMPONENTI_AIUTO": SimpleXMLElement {#1496 ▼
    +"COMPONENTE_AIUTO": array:2 [▼
      0 => SimpleXMLElement {#1495 ▼
        +"ID_COMPONENTE_AIUTO": "4302421"
        +"COD_PROCEDIMENTO": "2"
        +"DES_PROCEDIMENTO": "Notifica"
        +"COD_REGOLAMENTO": "CE1863-3.1/20"
        +"DES_REGOLAMENTO": "TF COVID-19 - Sezione 3.1 della Comunicazione della Commissione del 19.03.2020 C(2020) 1863 final e successive modifiche"
        +"COD_OBIETTIVO": "612200"
        +"DES_OBIETTIVO": "Rimedio a un grave turbamento dell'economia"
        +"SETTORE_ATTIVITA": "H.52.2"
        +"STRUMENTI_AIUTO": SimpleXMLElement {#1246 ▼
          +"STRUMENTO_AIUTO": SimpleXMLElement {#1520 ▼
            +"COD_STRUMENTO": "10"
            +"DES_STRUMENTO": "Garanzia (se del caso con un riferimento alla decisione della Commissione (10))"
            +"ELEMENTO_DI_AIUTO": "17842.53"
            +"IMPORTO_NOMINALE": "17842.53"
          }
        }
      }
      1 => SimpleXMLElement {#1494 ▼
        +"ID_COMPONENTE_AIUTO": "4302422"
        +"COD_PROCEDIMENTO": "2"
        +"DES_PROCEDIMENTO": "Notifica"
        +"COD_REGOLAMENTO": "CE1863-3.2/20"
        +"DES_REGOLAMENTO": "TF COVID-19 - Sezione 3.2 della Comunicazione della Commissione del 19.03.2020 C(2020) 1863 final e successive modifiche"
        +"COD_OBIETTIVO": "622200"
        +"DES_OBIETTIVO": "Rimedio a un grave turbamento dell'economia"
        +"SETTORE_ATTIVITA": "H.52.2"
        +"STRUMENTI_AIUTO": SimpleXMLElement {#1518 ▼
          +"STRUMENTO_AIUTO": SimpleXMLElement {#1522 ▼
            +"COD_STRUMENTO": "10"
            +"DES_STRUMENTO": "Garanzia (se del caso con un riferimento alla decisione della Commissione (10))"
            +"ELEMENTO_DI_AIUTO": "1000000.00"
            +"IMPORTO_NOMINALE": "1000000.00"
          }
        }
      }
    ]
  }
}
```

thanks ;)
Mar
22
1 month ago
Activity icon

Started a new Conversation MAIL QUEUE AttachData Barry/DomPDF

Hello to everyone...

I have a problem to queue some emails.

In the controller all works right ...but I don't know exactly ho queue this email.

This is the code that I have in the controller ...this send 200/300 emails:

foreach($payments as $payment) {
            $sumPrice = 0;
            foreach ($payment as $item) {
                $sumPrice += $item->price;
            }
            $data['email'] = $item->subscriber->user->email;
            $data['user'] = $item->subscriber->user->name;
            $data['residenza'] = $item->subscriber->user->residenza;
            $data['indirizzo'] = $item->subscriber->user->indirizzo;
            $data['codice_fiscale'] = $item->subscriber->user->codice_fiscale;
            $data['first_name'] = $item->subscriber->first_name;
            $data['last_name'] = $item->subscriber->last_name;
            $data['born_in'] = $item->subscriber->born_in;
            $data['born_at'] = $item->subscriber->born_at;
            $data['pagamento'] = $sumPrice;
            $data['data_modello'] = Carbon::createFromDate($request->data_modello)->format('d-m-Y');
            $pdf = PDF::loadView('prints.dichiarazione', $data);

            Mail::send('prints.dichiarazione', $data, function($message) use ($data, $pdf){
                $message->to($data["email"], $data["email"]);
                $message->subject('Modello Dichiarazione 730');
                $message ->attachData($pdf->output(), "dichiarazione.pdf");
            });
        }

How I can obtain the same result in queue?

Thanks very much for some help!

Mar
13
2 months ago
Activity icon

Replied to MaxAttemptsExceededException

I have try with the php artisan queue:work --tries=3 --timeout=4800 it seems work ;)

Activity icon

Started a new Conversation MaxAttemptsExceededException

Hi ... I give up it's too much for me; (

I created a Job that stores several records in the database after parseing several XML files.

Yesterday everything was working fine. Today he started giving me throwing this exception: MaxAttemptsExceededException.

I honestly don't know what to do anymore. I looked into the failed job table and found this in the cause:

Illuminate\Queue\MaxAttemptsExceededException: App\Jobs\XmlProcess has been attempted too many times or run too long. The job may have previously timed out. in /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:717
Stack trace:
#0 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(199): Illuminate\Queue\Worker->maxAttemptsExceededException(Object(Illuminate\Queue\Jobs\DatabaseJob))
#1 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Connection.php(471): Illuminate\Queue\Worker->Illuminate\Queue\{closure}(14, Array)
#2 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Connection.php(671): Illuminate\Database\Connection->Illuminate\Database\{closure}('insert into `xm...', Array)
#3 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Connection.php(638): Illuminate\Database\Connection->runQueryCallback('insert into `xm...', Array, Object(Closure))
#4 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Connection.php(472): Illuminate\Database\Connection->run('insert into `xm...', Array, Object(Closure))
#5 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Connection.php(424): Illuminate\Database\Connection->statement('insert into `xm...', Array)
#6 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Query/Processors/Processor.php(32): Illuminate\Database\Connection->insert('insert into `xm...', Array)
#7 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Query/Builder.php(2882): Illuminate\Database\Query\Processors\Processor->processInsertGetId(Object(Illuminate\Database\Query\Builder), 'insert into `xm...', Array, 'id')
#8 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php(1547): Illuminate\Database\Query\Builder->insertGetId(Array, 'id')
#9 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1052): Illuminate\Database\Eloquent\Builder->__call('insertGetId', Array)
#10 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1017): Illuminate\Database\Eloquent\Model->insertAndSetId(Object(Illuminate\Database\Eloquent\Builder), Array)
#11 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(858): Illuminate\Database\Eloquent\Model->performInsert(Object(Illuminate\Database\Eloquent\Builder))
#12 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/app/Jobs/XmlProcess.php(86): Illuminate\Database\Eloquent\Model->save()
#13 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\XmlProcess->handle()
#14 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#15 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#16 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#17 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#18 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call(Array)
#19 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}(Object(App\Jobs\XmlProcess))
#20 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\XmlProcess))
#21 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#22 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(118): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Jobs\XmlProcess), false)
#23 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}(Object(App\Jobs\XmlProcess))
#24 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(App\Jobs\XmlProcess))
#25 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#26 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Jobs\XmlProcess))
#27 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#28 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(410): Illuminate\Queue\Jobs\Job->fire()
#29 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(360): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#30 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(158): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), 'database', Object(Illuminate\Queue\WorkerOptions))
#31 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#32 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#33 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#34 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#35 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#36 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#37 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Container/Container.php(610): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#38 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call(Array)
#39 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/symfony/console/Command/Command.php(256): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#40 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#41 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/symfony/console/Application.php(971): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#42 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/symfony/console/Application.php(290): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#43 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/symfony/console/Application.php(166): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#44 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#45 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#46 /Users/iWebStudio/Development/projects/lavori/Ferrari-Genoni/Aiuti/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#47 {main}

I f someone can give me some help thank you very much

Mar
01
2 months ago
Activity icon

Replied to Undefined Index

I'm sorry ...I have let a first row in Excel file with some comments => and so I get the error ;))

Activity icon

Awarded Best Reply on Undefined Index

Resolved Sorry to all ;)

Activity icon

Replied to Undefined Index

Resolved Sorry to all ;)

Activity icon

Started a new Conversation Undefined Index

Sorry but I'm going crazy ...it has always worked ... from today i get this error but i can't understand what it could be.

I import an Excel file with maatwebsite excel, map it and do a massive update of the values. I don't why happen UNDEFINED INDEX CAVO

public function update(Request $request, ExcelImport $excel_importer)
    {
        $data = $excel_importer->import(request('import_file'));
        $chiavePrimaria = 'cavo';

        //sinistra: colonne excel - destra: colonne DB
        $mappa = collect([
            'master' => 'master',
            'cavo' => 'cavo',
            'pnf' => 'pnf',
            'fornitore_id' => 'fornitore_id',
            'descrizione' => 'descrizione',
            'descrizione_metel' => 'descrizione_metel',
            'stato_id' => 'stato_id',
            'tipologia_id' => 'tipologia_id',
            'categoria_id' => 'categoria_id',
            'cu_attuale_diff' => 'cu_attuale_diff',
            'cu_kg_km' => 'cu_kg_km',
            'moltiplicatore' => 'moltiplicatore',
            'netto_acquisto_vr15' => 'netto_acquisto_vr15',
            'base_cu' => 'base_cu',
            'netto_acquisto_cu_attuale' => 'netto_acquisto_cu_attuale',
            'q_minima' => 'q_minima'
        ]);

        if (count($data) == 0) {
            return redirect()->back()->with('not_possible', 'Non hai caricato nessun file oppure il file caricato è vuoto');
        }
        foreach ($data as $importRecord) {
            $record = Cavo::where($mappa[$chiavePrimaria], $importRecord[$chiavePrimaria])->first();
            $dataMap = collect($mappa)->values()->combine(collect($importRecord)->values())->toArray();
            // add @count for issue: Parameter must be an array or an object that implements Countable php 7.2
            if (@count($record) == 0) {
                $reportImportedRecord = $dataMap['cavo'];
                return redirect()->route('cavi.report')->with('not_possible', $reportImportedRecord);
            }

            $record->update($dataMap);
        }
        return redirect()->route('cavi.aggiornamento');
    }

Thanks for eventually Help...

Feb
23
2 months ago
Activity icon

Replied to Laravel Debugbar (MODEL)

Thanks I will look for some resource to read ... I offer a virtual beer;)

Activity icon

Replied to Laravel Debugbar (MODEL)

No @tykus I don't need all the records at once ... pagination does it directly datatables.

Activity icon

Replied to Laravel Debugbar (MODEL)

@tykus thanks for response ...I'm pretty new with Laravel ... what should I do about it since I work with Datatables? Server Side?

Activity icon

Started a new Conversation Laravel Debugbar (MODEL)

Hi ...I'm use a debugbar in a project and I Work with datatables (in blade I do a foreach for iterate the collection)

I have see that in the model load:

51 App\Models\Role

52 App\Models\User

I asked myself ... but if I retrieve thousands of records the model (example will mark 6000) does it affect system resources?

Am I wrong something?

Jan
03
4 months ago
Activity icon

Awarded Best Reply on Laravel 8 Middleware('auth') And Custom Guards

I have see in depth the Authenticate Middleware and I have found a method handle. This has the ability to get the guards. So I have declared a protected property $guards and return the parent handle method.

protected $guards;

    public function handle($request, Closure $next, ...$guards)
    {
        $this->guards = $guards;
        return parent::handle($request, $next, ...$guards);
    }

And after with this I have check in the method RedirectTo:

if (! $request->expectsJson()) {
            if (Arr::first($this->guards) === 'admin') {
                return route('admin.login');
            }

            return route('login');
        }

...maybe someone have the same problem ;)

Activity icon

Replied to Laravel 8 Middleware('auth') And Custom Guards

I have see in depth the Authenticate Middleware and I have found a method handle. This has the ability to get the guards. So I have declared a protected property $guards and return the parent handle method.

protected $guards;

    public function handle($request, Closure $next, ...$guards)
    {
        $this->guards = $guards;
        return parent::handle($request, $next, ...$guards);
    }

And after with this I have check in the method RedirectTo:

if (! $request->expectsJson()) {
            if (Arr::first($this->guards) === 'admin') {
                return route('admin.login');
            }

            return route('login');
        }

...maybe someone have the same problem ;)

Jan
01
4 months ago
Activity icon

Replied to Laravel 8 Middleware('auth') And Custom Guards

Thanks @redroseamit I already use Laratrsut ...I'm interesting now the native opportunity of Laravel.

Activity icon

Started a new Conversation Laravel 8 Middleware('auth') And Custom Guards

Hi ...I'm try to build, for learn better Laravel, a multiple Auth login.

I have create 2 form login one for Users and one for Admins. I have also create a custom guard called admin.

I have now two dashboards: AdminDash and UserDash ...my goal is, when someone try to go directly to one of this dashboard redirect to the right login page.

I'm use a middleware('auth') that is hardcoded and redirect back to login page.

I have resolved with this code in the redirectTo method in the authenticate Middleware.

protected function redirectTo($request)
    {
        if (! $request->expectsJson()) {
            if($request->getRequestUri() == '/admin/dashboard') {
                return route('admin.login');
            } else {
                return route('login');
            }
        }
    }

or maybe I can overwrite this method:

protected function unauthenticated($request, array $guards)

But I don't know if is the best method ...someone can give me an advise?

Thanks!

Dec
12
5 months ago
Activity icon

Awarded Best Reply on Cursed Storage

I have resolved with return a response in Controller.

I have create a route with some middleware

Route::get('images/{file}', [\App\Http\Controllers\CardController::class, 'getImage'])
    ->middleware(['auth:sanctum', 'verified']);;

And in te controller

/ / Check if file exists
        if (! File::exists(storage_path('immagini/' . $file))){
            abort(404, 'Non sei Autorizzato a visualizzare questa risorsa!');
        }

        $path = storage_path('immagini/' . $file);
        return response()->file($path);

...and finally in a view

<table id="cards" class="display" style="width:100%">
            <thead>
            <tr>
                <th>Titolo</th>
                <th>Anno</th>
                <th>Registro</th>
                <th>Tecnica</th>
                <th>Collezione</th>
                <th>Status</th>
            </tr>
            </thead>
            <tbody>
            @foreach($cards as $card)
            <tr>
                <td>
                    <img src="{{ $card->copertina }}" width="100" />
                    {{ $card->titolo }}
                </td>
                <td>{{ $card->anno }}</td>
                <td>{{ $card->registro }}</td>
                <td>{{ $card->tecnica }}</td>
                <td>{{ $card->collezione_privata }}</td>
                <td>{{ $card->checked }}</td>
            </tr>
            @endforeach
        </table>
Activity icon

Replied to Cursed Storage

I have resolved with return a response in Controller.

I have create a route with some middleware

Route::get('images/{file}', [\App\Http\Controllers\CardController::class, 'getImage'])
    ->middleware(['auth:sanctum', 'verified']);;

And in te controller

/ / Check if file exists
        if (! File::exists(storage_path('immagini/' . $file))){
            abort(404, 'Non sei Autorizzato a visualizzare questa risorsa!');
        }

        $path = storage_path('immagini/' . $file);
        return response()->file($path);

...and finally in a view

<table id="cards" class="display" style="width:100%">
            <thead>
            <tr>
                <th>Titolo</th>
                <th>Anno</th>
                <th>Registro</th>
                <th>Tecnica</th>
                <th>Collezione</th>
                <th>Status</th>
            </tr>
            </thead>
            <tbody>
            @foreach($cards as $card)
            <tr>
                <td>
                    <img src="{{ $card->copertina }}" width="100" />
                    {{ $card->titolo }}
                </td>
                <td>{{ $card->anno }}</td>
                <td>{{ $card->registro }}</td>
                <td>{{ $card->tecnica }}</td>
                <td>{{ $card->collezione_privata }}</td>
                <td>{{ $card->checked }}</td>
            </tr>
            @endforeach
        </table>
Activity icon

Replied to Cursed Storage

@michaloravec I have already tried but it doesn't work

Activity icon

Started a new Conversation Cursed Storage

Hi ...Are 2 hour that I try to resolve this problem.

I'm work in local with Homestead and Vagrant and Laraavel 8.x and JETSTREAM (all configured)

I'm try to build a simple application (I want learn good Laravel)

I have 2 simple Model Card and Picture with relative Controller.

All the route are accessible after verification the Email.

I have create a directory pictures in storage with all the images (so is not access from public)

I'm try to return in a view for each card a thumbnail of the image {{ asset('storage/pictures/name.extension) }}

...but nothing not works.

I have do a dd(File::exists(storage_path('pictures/1.jpg'))) => response is true!

In a view I have try also {{ \Illuminate\Support\Facades\Storage::url('immagini/1.jpg') }}

But I can't show in a View ;(

Dec
10
5 months ago
Activity icon

Started a new Conversation Permission AWS S3 Bucket

Hi ...I try to use Aws s3 Bucket.

I want build an application that storage the images on S3. I have try with code in Laravel and all works fine.

I have only a big question: How I set the permission: I have 4 option in S3 but I don't undestand what checked.

My application store only Images and all are public.

Thanks

Nov
29
5 months ago
Activity icon

Replied to Markdown And Tailwind Css

thanks ;)

Activity icon

Replied to Markdown And Tailwind Css

Thanks @snapey ...I have understand this concept. What not is really clear is: the body become from the database table from column body with different tag => how I create custom style?

<h1>Title</h1>
<p>Body</p>
<em>Example</>

maybe:

.markdown h1 h2 h3 {
	text-white,
	....
}

thanks

Activity icon

Replied to Markdown And Tailwind Css

Thanks for the response @snapey .

Really I haven't understand ;(.

...I'm new with tailwind ...thanks.

Activity icon

Started a new Conversation Markdown And Tailwind Css

Hi...

Someone can help me with this strange behavior?

I use a mail markdown for a body of my post:

{{ Illuminate\Mail\Markdown::parse($article->body) }}

All markdown works right apart the Hx style (1, 2, 3 ...). This happen when I have the:

<link rel="stylesheet" href="{{ mix('css/app.css') }}">

...I have try to find the solution but nothing ;(

Nov
26
5 months ago
Activity icon

Replied to Rule Unique

@nakov yes ;) resolved thanks !!

Activity icon

Replied to Rule Unique

@nakov I have check with a dd and is right.

The scenario is this: I have a User that have an Account (one to one relation).

So in the accounts table I have a field user_id.

So I insert in the Rule the auth()->user()->account->id (so I'm sure to retrive the right record to update.

but nothing ;(

Activity icon

Started a new Conversation Rule Unique

Hi ...I have try to find solution without success.

I try to ignore an id when update a record.

I have a table called accounts, and a function that do the validation ($this->validate).

I have insert on VAT the rule

Rule::unique('accounts')->ignore($this->id)

...but not work.

Someone have advise?

Thanks

Nov
18
5 months ago
Activity icon

Replied to Pass Data To Component

I have this scenario:

PageController

public function show($id)
{
	$page = Page::findOrFail($id);
	return view('page.index', compact('page'));
}

In the view page I have a component called content.

How I can pass the $page variable from controller to this component like so?

<x-content>

$page->id

$page->name

....

</x-content>

Maybe is a stupid question because I haven't understand how work the components?

Thanks for the hel ;)

Nov
09
6 months ago
Activity icon

Awarded Best Reply on Laravel 8 Jetstream And Tailwind

After restart Mac and vagrant all works right ;)

Thanks for support ;)

Activity icon

Replied to Laravel 8 Jetstream And Tailwind

After restart Mac and vagrant all works right ;)

Thanks for support ;)

Activity icon

Replied to Laravel 8 Jetstream And Tailwind

I have found a strange behavior ...in firefox not work in Chrome yes, in Safari yes!

I have try from console in firefox to edit a css => when I change any value the css work.

Very strange...

Activity icon

Replied to Laravel 8 Jetstream And Tailwind

I get no error in network tab and in the css file exist the class.

I have try a new fresh installation without jetstream and all work ...with jetstream not work ;(

Activity icon

Replied to Laravel 8 Jetstream And Tailwind

Yes I have installed

npm install tailwindcss

after:

npm run dev

but nothing ...this is my webpack.config.js

const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel applications. By default, we are compiling the CSS
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
        require('postcss-import'),
        require('tailwindcss'),
    ])
    .webpackConfig(require('./webpack.config'));

and this the tailwind.js

const defaultTheme = require('tailwindcss/defaultTheme');

module.exports = {
    purge: [
        './vendor/laravel/jetstream/**/*.blade.php',
        './storage/framework/views/*.php',
        './resources/views/**/*.blade.php',
    ],

    theme: {
        extend: {
            fontFamily: {
                sans: ['Nunito', ...defaultTheme.fontFamily.sans],
            },
        },
    },

    variants: {
        opacity: ['responsive', 'hover', 'focus', 'disabled'],
    },

    plugins: [require('@tailwindcss/ui')],
};

...need something more?

Activity icon

Started a new Conversation Laravel 8 Jetstream And Tailwind

I'm go crazy ;)

Sorry ...before post I have read some documentation but I can't find the solution.

I have a Laravel project with jetstream ...I want implement tailwind with all css (full).

I have duplicate the dashboard view and renamed test => after I have replace qith this snippet:

<x-app-layout>
    <x-slot name="header">
        <h2 class="font-semibold text-xl text-gray-800 leading-tight">
            {{ __('Dashboard') }}
        </h2>
    </x-slot>

    <div class="py-12">
        <div class="bg-indigo-700">
            <div class="max-w-2xl mx-auto text-center py-16 px-4 sm:py-20 sm:px-6 lg:px-8">
                <h2 class="text-3xl leading-9 font-extrabold text-white sm:text-4xl sm:leading-10">
                    <span class="block">Boost your productivity.</span>
                    <span class="block">Start using Workflow today.</span>
                </h2>
                <p class="mt-4 text-lg leading-6 text-indigo-200">Ac euismod vel sit maecenas id pellentesque eu sed consectetur. Malesuada adipiscing sagittis vel nulla nec.</p>
                <a href="#" class="mt-8 w-full inline-flex items-center justify-center px-5 py-3 border border-transparent text-base leading-6 font-medium rounded-md text-indigo-600 bg-white hover:text-indigo-500 hover:bg-indigo-50 transition duration-150 ease-in-out sm:w-auto">
                    Sign up for free
                </a>
            </div>
        </div>
    </div>
</x-app-layout>

When I write the code, the intellisense correctly proposes tailwind ... so it's present in the css.

But not apply the style ...someone can help me to understand?

Thanks ;)