mercredi 1 juillet 2020

When copying data to another table, parent_id issue in Laravel

I am using Laravel + MySQL.

I have following three tables:

templates table
id
name

template_pages table
id
template_id
parent_id
name
content


user_pages table
id
user_id
parent_id
name
content

When user picks one template, it will get pages from template_pages table.

Here, I want to create the new records to user_pages table.

I could get pages rows from template_pages table with template_id which user picked.

But when I insert them to user_pages table, parent_id wasn't match as I expected.

One user can get several same templates.

Please help me how I can solve this issue.

Thank you



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire