Support the ongoing development of Laravel.io →
Database Eloquent Architecture
Last updated 2 years ago.
0

could you please post what is the error if you don't manually typecast the variable?

0

There is no error, as such. It just simply returns an empty array.

What I have noticed is that if I use

Object::find($id);

I have a result set with content from the Eloquent model, but if I try a where clause, like

Object::all()->where('column','=',$id);

I get the empty result set.

Another difference I noticed (by using dd() function) is that in my production server, $id is sent as an integer to the method at the controller, but in my Homestead local environment, it returns as a string. I tested this by using:

 public function index($id)
    {
        dd($id);
        return Grouping::all()->where('group_id', $id);
    }
0

I have been searching a little more and found nothing about why my code in production should be different from the development Homestead version for it to work.

I have eliminated this difference by connecting my Homestead into the production database on Internet, instead of using a local copy. Maybe there might be something about collation, or something similar that makes this difference.

Last updated 9 years ago.
0

I found a partially the answer to my doubts and documented my findings at this StackOverflow link

0

Sign in to participate in this thread!

Eventy

Your banner here too?

iaef iaef Joined 1 Jul 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.