I have created a curd using curd generation (with table status) in yii2-advanced application. and curd(create,view,edit,delete) is working properly.
Now I have created a new table relation (id, user_id, status_id) where user_id is the foreign key for user table and status_id is also foreign key for status table.
Now I want to update table relation on update status from backend.
For example :
-
If one user (user_id is 1) creates new status then there will be a new entry in relation table like "relation (1, 1, {status_id just created by user})".
-
if user delete status then the row with this status_id will also be removed from relation table.
-
And these created status only visible to user_id 1 only not to other users (one user can only see his created status not to others).
I am new to this framework, so please guide me how to implement this scenario in my application?
Thanks in advance.