Level 56
That whats partials are for. Check the docs about blate templating.
@include('table_partial', ['edit' => $edit_url, 'destroy' => $destroy_url])
2 likes
If lets say I have 20 views that are tables that all use the same structure and in the last field of every table they have the actions column that displays the edit, delete, etc. icons Would it be better to extract the code out and put it into a function?
For example this is what I currently have. The first part of the object in the route changes depending on the resource in the table obviously as does the variable name. I just changed it to show randomness.
<td class="center">
<a data-original-title="Edit" href="{{ route('routenamehere.edit', $variablenamehere->id) }}" data-toggle="tooltip" title="" class="tooltips"><i class="fa fa-pencil"></i></a>
<a data-original-title="Delete" href="{{ route('routenamehere.destroy', $variablenamehere->id) }}" data-toggle="tooltip" title="" class="tooltips ajax-delete"><i class="fa fa-trash-o"></i></a>
</td>
That whats partials are for. Check the docs about blate templating.
@include('table_partial', ['edit' => $edit_url, 'destroy' => $destroy_url])
Please or to participate in this conversation.