cURL error 60: SSL certificate problem: unable to get local issuer certificate guzzle

When we work with cURL sometimes we get an error like “cURL error 60: SSL certificate problem: unable to get local issuer certificate guzzle”.

I spent much time and finally found a solution:

Step one: 

Download .pem file from here (https://gist.github.com/VersatilityWerks/5719158/download) and put cacert.pem file in a directory.

Then call guzzle like below:

$client = new \GuzzleHttp\Client();
$client
->setDefaultOption('verify', 'C:\Program Files (x86)\Git\bin\curl-ca-bundle.crt');

Enjoy!

Eloquent collection: counting and detecting is empty or not

When using ->get() you cannot simply use any of the below:

 

if (empty($result)) { }
if (!$result) { }
if ($result) { }

Because if we dd($result); we will notice an instance of Illuminate\Support\Collection is always returned.

So to determine is there any result, we can use anyone of following:
if ($result->first()) { } 
if (!$result->isEmpty()) { }
if ($result->count()) { }
if (count($result)) { }

How to upload / import mysql phpmydadmin database larger than 2MB

There is a couple of ways to solve this problem.

1) Split your SQL file into multiple 2MB chunks

OR

2)

Update your php.ini file like following (works on dedicated/local servers – any server where you have root user permission or allowed to overwritten the file)

Search for following settings:

post_max_size = 8M
upload_max_filesize = 2M
max_execution_time = 30
max_input_time = 60
memory_limit = 8M
Change to: ( or any size you want but it will depend on your server available resources )
post_max_size = 35M
upload_max_filesize = 35M
max_execution_time = 5000
max_input_time = 5000
memory_limit = 1000M