Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Able to get collection, but not filtered data in production version of Slim app using Eloquent

Tags:

eloquent

slim

I've been working on a Slim 2 and have just recently started deploying to a production server. Everything seems to be working okay so far. I'm able to log in so I know that I'm connecting to the database just fine. It recognized who I'm logged in as recognized what permissions I have as this user. I have another table with several entries. When I do...

$collection = collect($app->item->where('user_id', $userId)->get());

and then...

print_r($collection);

on the production server, I see the whole collection just like I do on the development server, but when I add...

$pack = $collection->where('status', 1);

and instead of printing the collection, try to print the pack like...

print_r($pack);

this message comes back...

Illuminate\Support\Collection Object ( [items:protected] => Array ( ) )

where on the development version I get the filtered collection as I would expect. How can I alter the code to work in both development and production environments?

like image 854
user2530671 Avatar asked Oct 09 '16 20:10

user2530671


1 Answers

Most likely you don't have records in the production database with a status of 1 and you do have records with a status of 1 in development.

Check the database directly in production to verify.

like image 68
quickshiftin Avatar answered Oct 14 '22 06:10

quickshiftin