Skip to content
Advertisement

Tag: where-clause

Laravel Eloquent where statement returns no attributes

So from my previous post, I was advised to start using Eloquent models, which I did. My end goal, is to print out specific gifts, that belongs to that specific box. Migrations: gift_items: gift_campaigns: Pivot table: Controller: Error that I receive using this way: Seems like the updated version is trying to call the gift_campaigns table id, instead of the

MySQL SELECT in order of array values

Can anyone help me with a Query query? I have an array of IDs $IDvalues = array(“128”, “159”, “7”, “81”, “82”, “83”); And need to retrieve data from another table in the order of the array. At the moment, I have this query: But it’s getting it in numerical order (7, 81, 82, 83, 128, 159). I need 128 first,

Search function on multiple rows in the same table

I’m wondering how do I add more row’s on my search script to be searched. Here’s my php script: As you can see this: I want to it to search on region and rank rows. I tried: …. it’s showing 0 results. Thank you in advance. Answer Is this what you want? This searches for the parameter in both columns

Laravel where on relationship object

I’m developing a web API with Laravel 5.0 but I’m not sure about a specific query I’m trying to build. My classes are as follows: and Now, I want to get all the events with a specific participant. I tried with: but the where condition is applied on the Event and not on its Participants. The following gives me an

Advertisement