Large Collection is Empty in HTML?

Posted 1 year 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.

Reply to

Use Markdown with GitHub-flavored code blocks.