Support the ongoing development of Laravel.io →
Database Views Blade

i have a routine which generates this code:

<td style="text-align:left">
{{ Form::label("record_type","record_type") }}
</td>
<td style="text-align:left">
{{ Form::text('record_type',$data_array_name['record_type']) }}
</td>
</tr>
<tr>
<td style="text-align:left">
{{ Form::label("name","name") }}
</td>
<td style="text-align:left">
{{ Form::text('name',$data_array_name['name']) }}
</td>

and saves it as a file which i include in my read loop inside the view

@include("...'browse_select_display_snippet')

is there any way, i can pass it directy to the view instead of having to create the file and reference it? thanks

Last updated 3 years ago.
0

I guess the view should be dynamically generated while iterating an array? maybe use partial views? you can pass the object at the index to the partial view.

maybe something like:

controller- return vew with array

main view- foreach (array as element) include('partials/elementView', element)

partial view- table with rows and stuff for each element['key']

0

i owe you a beer. Everything's already in the 'parent' view so this is all that's needed in the partial_view.

@foreach ($field_names_array as $name)
	<?php echo($snippets_array[0].$record[$name].$snippets_array[1]);?>
@endforeach

i am a happy coder!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

stu3881 stu3881 Joined 22 Nov 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.

© 2025 Laravel.io - All rights reserved.