berinjelablues

berinjelablues

Member Since 1 Year Ago

Ceilândia

Experience Points
2,140
Total
Experience

2,860 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
16
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.

Level 1
2,140 XP
May
13
5 months ago
Activity icon

Replied to How To Call A Long Duration MySQL Stored Procedure On Laravel?

@SNAPEY -

php artisan queue:work --queue high,default --tries=1 --timeout=0

This comand sets the timeout=0.

Do you think that a still need to increase the timeout on PHP?

May
10
5 months ago
Activity icon

Started a new Conversation How To Call A Long Duration MySQL Stored Procedure On Laravel?

I can't fully execute a long duration MySQL Stored Procedure on Laravel. This Procedure execute a lot of data tests and insert millions of rows on a table and take about 10 minutes to process.

I'm totally sure that this procedure is working when a call it by command line on Linux but I was unable to make it work by calling it by a Web Application.

Until now I've tried to call on a queued job but the job fail with this error:

Illuminate\Queue\MaxAttemptsExceededException:

Job code:

DB::select('call sp_valida_arquivo("1", "7")');

This is my worker settings:

php artisan queue:work --queue high,default --tries=1 --timeout=0

I would like to understand what is going wrong when calling the procedure on Laravel.

Mar
22
6 months ago
Activity icon

Started a new Conversation How To Increase Storage Space On Homestead Vagrant?

Hello guys.

First of all, I would like to thank you all for the kindness of this community that always surprises me.

Currently I came across a annoying problem of lack of storage space in my Homestead/Vagrant/VMBox installation. After reading some online tutorials, I believe I have gathered some evidence about what I need to do.

Until now I have been able to do the following:

  1. Create a copy of the file "C:\Users\MyUser\VirtualBox VMs\homestead-7\ubuntu-18.04-amd64-disk001.vmdk" in the ".vdi" extention through the "clonehd" function of the "VBoxManage" on CMD with the following command:
C:\Program Files\Oracle\VirtualBox> VBoxManage clonehd "C:\Users\MyUser\VirtualBox VMs\homestead-7\ubuntu-18.04-amd64-disk001.vmdk" "C: \BKP_HD_VAGRANT\cloned.vdi" --format vdi
  1. Increase the Capacity of the VDI Copy via CMD with the command:
C:\Program Files\Oracle\VirtualBox> VBoxManage modifyhd "C:\bkp_hd_vagrant\cloned.vdi" --resize 209715
  1. Change the Sata Controller storage reference in the VMBox to the new file "cloned.vdi"

Unfortunately from now on I’ve not been able to continue. I’ve tried to execute the steps listed on the following tutorial but nothing works.

https://laracasts.com/discuss/channels/guides/a-guide-to-extending-homestead-storage-capacity

However, my configuration is very different from what is shown in the images in this guide as you can see below.

Disk /dev/sda: 195.3 GiB, 209715200000 bytes, 409600000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xeb0a5011

Device     Boot Start       End   Sectors Size Id Type
/dev/sda1  *     2048 134215679 134213632  64G 8e Linux LVM


Disk /dev/mapper/vagrant--vg-root: 63 GiB, 67687677952 bytes, 132202496 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vagrant--vg-swap_1: 980 MiB, 1027604480 bytes, 2007040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Filesystem                     1K-blocks      Used Available Use% Mounted on
udev                             4053320         0   4053320   0% /dev
tmpfs                             816832      6504    810328   1% /run
/dev/mapper/vagrant--vg-root    64800356  10692068  50786844  18% /
tmpfs                            4084152         8   4084144   1% /dev/shm
tmpfs                               5120         0      5120   0% /run/lock
tmpfs                            4084152         0   4084152   0% /sys/fs/cgroup
vagrant                        109370364  97896548  11473816  90% /vagrant
home_vagrant_code              976629756 146938732 829691024  16% /home/vagrant/code
home_vagrant_backup            976629756 146938732 829691024  16% /home/vagrant/backup
home_vagrant_backup_importacao 976629756 146938732 829691024  16% /home/vagrant/backup_importacao
tmpfs                             816828         0    816828   0% /run/user/1000

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/sda: 195.3 GiB, 209715200000 bytes, 409600000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xeb0a5011

Device     Boot Start       End   Sectors Size Id Type
/dev/sda1  *     2048 134215679 134213632  64G 8e Linux LVM

Would anyone know what I should do to adapt this guide to be able to solve my problem taking into account my current situation?

Apr
04
1 year ago
Activity icon

Replied to How To Get The Encoding Of A Uploaded .csv File?

Unfortunately this function was not able to determine the encoding of the .csv file I have. It simply does not return anything.

Apr
03
1 year ago
Activity icon

Started a new Conversation How To Get The Encoding Of A Uploaded .csv File?

In my application I have a functionality that imports data from peripheral systems through ".csv" files.

Many of these files come in portuges a language full of unfamiliar accents for most programming languages.

So I need to figure out what is the encoding of each file that I uploaded to my server before importing its data into the database.

I'm using Spout to open and manipulate CSV files within my application.

Here is my code:

    $reader = Box\Spout\Reader\ReaderFactory::create(Box\Spout\Common\Type::CSV);
    $reader->setEncoding('Windows-1252');         
    $reader->setFieldDelimiter(';');
    $reader->open('../storage/app/Test/test.csv');

Thanks in advance.

Mar
14
1 year ago
Activity icon

Replied to Why I Can't Pass Objects To A Job?

Thank you @martinbean . You're absolutely right.

Just for the sake of understanding here is the final code:

On the controller:

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Jobs\JobToDo;
use App\Models\ObjectToSend;

class TestController extends Controller{
    public function create(){
            $objectToSend = ObjectToSend::where('id', 1)->first();

            JobToDo::dispatch($objectToSend);
    }
}

On the job:

use App\Models\ObjectToSend;

use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Support\Facades\DB;

class JobToDo implements ShouldQueue {

        use Dispatchable,
                InteractsWithQueue,
                Queueable,
                SerializesModels;

        private $object;

        public function __construct(ObjectToSend $objectToInsert) {
            $this->object = $objectToInsert;
        }

        public function handle() {

            DB::table('test')->insert(
                    ['name' => $this->object->name,  'object_id' => $this->object->id ]
            );

        }
}
Activity icon

Started a new Conversation Why I Can't Pass Objects To A Job?

On my application I need to pass a object to a Job who will be queued but for some unknown reason that Job can't be done.

For my surprise the job is executed when I remove the object parsed trough the 'dispatch' method.

I'm using the command below to run the worker who execute the job on the queue.

    artisan queue:work

This is my controller:

    use Illuminate\Http\Request;
    use App\Http\Controllers\Controller;
    use App\Jobs\JobToDo;
    use App\Models\ObjectToSend;

    class TestController extends Controller{
        public function create(){
                $objectToSend = ObjectToSend::where('id', 1)->first();
    
                JobToDo::dispatch($objectToSend);
        }
    }

This is my Job:

    use App\Models\ObjectToSend;

    use Illuminate\Bus\Queueable;
    use Illuminate\Queue\SerializesModels;
    use Illuminate\Queue\InteractsWithQueue;
    use Illuminate\Contracts\Queue\ShouldQueue;
    use Illuminate\Foundation\Bus\Dispatchable;
    use Illuminate\Support\Facades\DB;


    class JobToDo implements ShouldQueue {

         use Dispatchable,
                 InteractsWithQueue,
                Queueable,
                SerializesModels;


            public function __construct() {
                 //
            }

        public function handle(ObjectToSend $objectToInsert) {

    
                DB::table('test')->insert(
                        ['name' =>  => $objectToInsert->name,  'object_id' => $objectToInsert->id ]
                );
        }
    }
Feb
23
1 year ago
Activity icon

Replied to How To Create A Incremental Array To Make A Bulk Insert On Query Builder

It work, and I know what I was doing wrong.

In my code I need to increment an array column by column so I cant use the example found on:

https://laravel.com/docs/5.6/queries

    DB::table('users')->insert([
        ['email' => '[email protected]', 'votes' => 0],
        ['email' => '[email protected]', 'votes' => 0]
    ]);

Due to my lack of familiarity with this form of sitaxe of arrays above I did not know that I could get to the same result as follows:

$line_insert['email'] =  '[email protected]';
$line_insert'[votes'] =  0;

$final_insert[0] = $line_insert;

$line_insert['email'] =  '[email protected]';
$line_insert['votes'] =  0;

$final_insert[1] = $line_insert;

DB::table('users')->insert($final_insert);

On another words, I didnt figure that:

$line_insert[0]['email'] =  '[email protected]';
$line_insert[0]['votes'] =  0;

//is the same that
$line_insert = ['email' => '[email protected]', 'votes' => 0];

So the correct way to do what I need is:

$line_count = 0;
foreach ($table as $line) {
    $column_count = 0;
    foreach ($line as $column) {
        $array_line[$line_count][$field_names[$column_count]] = $column;
                    $column_count++;
    }
    $line_count++;
}
DB::table('table')->insert($array_line);
Feb
22
1 year ago
Activity icon

Replied to How To Create A Incremental Array To Make A Bulk Insert On Query Builder

@austenc @biishmar Thank you guys.

Unfortunately the way you guys suggested does not worked to me. Even changing the code to:

    $column_count = 0;
    foreach ($line as $column) {
           $array_line[$column_count] = [$field_names[$column_count] => $column];
           $column_count++;
    }
    DB::table('table')->insert($array_line);

When using the command:

    DB :: table ('table') -> insert ($ array_line); 

I get an error that shows me how Laravel set up my query like this:

    INSERT INTO table (column1) VALUES (value_original_column_1), (value_original_column_2), (value_original_column_3);

When te correct way should be:

   INSERT INTO table (column1, colum2, column3) VALUES (value_original_column_1, value_original_column_2, value_original_column_3);

Somebody can tell me why this is happening?

Feb
21
1 year ago
Activity icon

Started a new Conversation How To Create A Incremental Array To Make A Bulk Insert On Query Builder

I need to do something like the example below but I do not know how to add the field to the array.

                        $column_count = 0;
                        foreach ($line as $column) {

                            $array_line[$column_count] = $field_names[$column_count] => $column;
                            $column_count++;
                        }
                        DB::table('table')->insert($array_line);
Dec
27
1 year ago
Activity icon

Replied to Vagrant UP - Unable To Mount One Of Your Folders

@bobbybouwmann Thank you very much, this tutorial is all that the laravel homestead documentation should have been. Thank you very much indeed.

Dec
26
1 year ago
Activity icon

Started a new Conversation Vagrant UP - Unable To Mount One Of Your Folders

After execute the command "vagrant up" I receive the following message:

homestead-7: Unable to mount one of your folders. Please check your folders in Homestead.yaml

I'm running "VirtualBox" on Windows 10 besides "Vagrant".

Homestead.yaml:

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: 
~/.ssh/id_rsa.pub
keys:
    - ~/.ssh/id_rsa
folders:
    - map: ~/code
    to: /home/vagrant/code
sites:
    - map: homestead.test
    to: /home/vagrant/code/Laravel/public
databases: - homestead

Please help me, I can't see where is the error.

Activity icon

Replied to What Is The Home Directory?

Thank you!

Activity icon

Started a new Conversation What Is The Home Directory?

I'm trying to install homestead on windows and on the documentation it says:

"Installing Homestead

You may install Homestead by simply cloning the repository. Consider cloning the repository into a Homestead folder within your "home" directory, as the Homestead box will serve as the host to all of your Laravel projects:"

But, I don't Know what should be my home directory.

Can anyone help me to understand this?

Dec
21
1 year ago
Activity icon

Replied to Password Reset - Email Never Reaches The Recipient.

This is what is on my env file:

MAIL_DRIVER=smtp

MAIL_HOST=smtp.liberumratings.com

MAIL_PORT=587

[email protected]

MAIL_PASSWORD=********

MAIL_ENCRYPTION=tls

I know this settings are working because I just test on another application on the same server using PHPMailer.

Activity icon

Replied to Display Data In Input Type File

If it is a product edition form, you need to send a product object through your controller to your view.

This fuction should be on your controller:

public function edit($id) {

    $product = $this->product->find($id);
    return view('edit', compact('product'));
    
}
Activity icon

Started a new Conversation Password Reset - Email Never Reaches The Recipient.

I was able to properly configure the env file and even receive the message; "We have e-mailed your password reset link!" The email never reaches the recipient.