Support the ongoing development of Laravel.io →
Configuration Views Blade
Last updated 1 year ago.
0

View composers are called later, so they will overwrite keys set before.

You could check if value exists, and add default values only if they doesn't.

Cleanest way to accomplish this would be (off the top of my head):

  1. Set array with default values.
  2. Get all data passed to view (do not remember method, but i know there is one).
  3. Merge both arrays into one
  4. Set merged array as view variables.

Still, it seems to be wrong... But will do what you want

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

darkness darkness Joined 1 Feb 2014

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.