could you please post what is the error if you don't manually typecast the variable?
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);
}
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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community