Large Collection is Empty in HTML?

Posted 8 months ago by okmkey45

Hello

From a controller I have a large collection and it has a lot of data. I send it to the view with:

return view('admin.create', compact('fields'));

And I used it in my blade file like:

<custom-form
    :fields="{{ $fields }}"
>
</custom-form>

While I was developing everything worked good. Then today I deployed the app and something went wrong.

So I checked the collection and it has the data but in the HTML it came as an empty string. I checked the source code in my browser and I had this:

<custom-form
    :fields=""
>
</custom-form>

Not event an empty array, just an empty string. After two hours I applied a limit on the collection like this:

$fields = $fields->take(2);
return view('admin.create', compact('fields'));

And this time, in the HTML I had some values.

My question is: could it be that a large collection canĀ“t be sent to the browser? is it because laravel? is it because PHP? maybe is there a limitation on the server?

I hope someone can help me.

Thanks

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.