laravel / ideas

Issues board used for Laravel internals discussions.
938 stars 28 forks source link

how to check @stack(variable) is isset or not in laravel blade (Feature Request) #2549

Open sanmitpawar opened 3 years ago

sanmitpawar commented 3 years ago

we are having @push('variable')
contents @endpush

and will call the same using

@stack('variable')

how to check that stack is isset or not and if not isset allow pushing some content like @yield

jelib3an commented 3 years ago

Hi there, sorry if I misunderstand what you are asking. Are you asking to push the content only if it doesn't already exist? Would @once do what you are looking for? https://laravel.com/docs/master/blade#the-once-directive