php - Reusing Blade Template in different tabs
Get the solution ↓↓↓I have body.blade.php in table folder that displays an array passed from controller to view
@include('table.body', [$cols, $rows, $table_no])
Now, I have converted that array into percentage and would like to show that too. I passed the $table_no and $table_percentage. In the view I have coded
Tab 1 - View Numbers
@include('table.body', [$cols, $rows, $table_no])
Tab 2 - View Percentage
@include('table.body', [$cols, $rows, $table_percentage])
I have duplicated the body.blade.php for $table_no and $table_percentage but wish to know if there is an elegant way to do this.
Answer
Solution:
You can pass different array as an array
@foreach($tables as $table_no)
@include('table.body', [$cols, $rows, $table_no])
@endforeach
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: git was not found in your path, skipping source download
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.