dimanche 25 octobre 2015

How to print the subtasks belonging to specific tasks in Laravel Blade

This is really difficult for me to wrap my head around, so please excuse me if I don't give a good enough explanation of the situation.

I have a table "tasks", and the only column that I'm really using for this problem is | tasks_id |.

I created another table "subtasks", and it has these relevant columns:

| subtasks_id | subtasks_title | subtasks_tasks_id |

For each row in the table "tasks", there are n rows of subtasks with a different subtasks_id but the same subtasks_tasks_id.

I print the tasks by passing them to an array in my HomeController and looping through the array in the blade template. For every TASK, how would I also loop every SUBTASK, which has the same subtasks_tasks_id and the tasks' tasks_id?

Is there a way to use the ->where() clause in the blade template? I'm quite new to Laravel, also I didn't know how to word this into a google search so please do forgive my ignorance. Thank you in advanced.

P.S. I will keep on trying to solve this unless someone gives me an answer beforehand, if I do solve it I will post my answer, if not, please don't hesitate trying to help me :P, thank you again.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1LuJvUa
via IFTTT

Aucun commentaire:

Enregistrer un commentaire