bcharron

Web Developer at Sephone Interactive Media

Experience

1,020

0 Best Reply Awards

  • Member Since 8 Months Ago
  • 8 Lessons Completed
  • 0 Favorites

15th June, 2018

bcharron left a reply on MySQL With SSL Returns Bad Gateway • 3 days ago

@jdc1898 I have not tried that, but this link seems to be specific to AWS RDS, which we are not using.

14th June, 2018

bcharron started a new conversation MySQL With SSL Returns Bad Gateway • 4 days ago

I am trying to connect to a SSL enabled database with a Laravel application, but when I do so, I get a bad gateway error. Per a few different resources, I found the following configuration for the MySQL driver to add support for SSL connections, but with this driver configuration, I get the Bad Gateway error.

Driver

'mysql' => [
            'driver' => 'mysql',
            'host' => env('DB_HOST', '127.0.0.1'),
            'port' => env('DB_PORT', '3306'),
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'unix_socket' => env('DB_SOCKET', ''),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_unicode_ci',
            'prefix' => '',
            'sslmode' => env('DB_SSLMODE', 'prefer'),
            'options'   => [
                PDO::MYSQL_ATTR_SSL_CA    => '/path/to/file/ca.pem',
                PDO::MYSQL_ATTR_SSL_CERT    => ''/path/to/file/client-cert.pem',
                PDO::MYSQL_ATTR_SSL_KEY    => ''/path/to/file/cleint-key.pem'
            ],
            'strict' => true,
            'engine' => null,
        ],

I am using Laravel Valet as the development environment for this. I get the following error in the Valet NGINX error log: 2018/06/14 07:51:50 [error] 6495#0: *15 upstream prematurely closed connection while reading response header from upstream, client: 127.0.0.1, server: ccc.dev, request: "POST /oauth/token HTTP/1.1"

Does anyone know how to resolve this issue with a SSL enabled DB connection in a Laravel application or on Valet?

15th December, 2017

bcharron left a reply on FirstOrCreate/New With MySQL Operators • 6 months ago

Thank you @Dry7 & @tykus, this is what I anticipated, I just wanted to check and make sure I was not overlooking something that would accomplish what I wanted to do.

@tykus The code you provided works. Only adjustment is that the if statement check is missing a $ before dma.

bcharron started a new conversation FirstOrCreate/New With MySQL Operators • 6 months ago

I am trying to use the firstOrCreate or firstOrNew Eloquent methods to find a record in the database by a column in a given table. I'd like to use the like MySQL operator to search for records that do not 100% match the current entry. From what I can tell, these methods only allow for the column and the value with no special operators. Is there a way to use these methods how I have described?

Here is an example of what I would like to do (does not work currently)

$dma = Dma::firstOrCreate(
    ['name', 'like', "%$market%"]
);

The above code produces the following error:

SQLSTATE[42S22]: Column not found: 1054 Unknown column '0' in 'where clause' (SQL: select * from column where (0 = name and 1 = like and 2 = %Market%) limit 1)

I understand that this error occurs because the array is not formed properly for the firstOrCreate method, but is there a way to make this work or an alternative that will accomplish what I am looking to do?

28th November, 2017

bcharron started a new conversation Filesystem S3 Driver - Working With Object Versions • 6 months ago

I using AWS S3 to store files that are uploaded to my application. I have 1 file that will be uploaded on a weekly basis. This file has the same name every week. S3 has an option to store versions for a specific object, thus the file will not be overwritten when uploaded each week. I am wondering if there is a way to interact with a specific version of the S3 object? I would like to get the version ID back from the Storege::put request, so that I might be able to retrieve a specific object version. When I run Storage::get($filename), I get the latest version of the file, but nothing more than the file contents. I have also tried Storage::getMetadata, but the version is not included with that information.

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.