3 years ago

Add integer to eloquent collection

Posted 3 years ago by FutureWeb

Hi LaraPeeps,

I am trying to add an integer to an eloquent collection:

$deals = Deal::with('stuff')->where('this','=','that')->take(20)->get();

and then I am trying to append an integer to the collection like this

$deals->last_page = $count;

or like this


but I always get the following error: Object of class stdClass could not be converted to int

Any pointers would save me a good amount of hair.

Thanks in advance :)

Please sign in or create an account to participate in this conversation.