Web Developer at Sephone Interactive Media



0 Best Reply Awards

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

15th December, 2017

bcharron left a reply on FirstOrCreate/New With MySQL Operators • 3 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 • 3 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 • 3 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

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