I have a problem writing on the forum. Can anyone please help me if you have time?
雪梦晨、曦
雪梦晨、曦 2021-04-04 11:05:06
0
2
971

The collected post has been deleted by the user, which means that the post table does not have this post, but the collection table still has data. I used the associated method to find out that it is empty. However, the result I want is to display "This post has been deleted." ”

php code:

$collect = db('collect')->where('user_id',session('user_data.id'))

- >alias('a')->join('content b','a.content_id=b.id')

->paginate(10);

Post table :

Collection list:

雪梦晨、曦
雪梦晨、曦

reply all(2)
枫叶知秋

Do not delete physically, try to delete logically and modify the status.

Currently designed to try LEFT JOIN

db('collect')->where('user_id',session('user_data.id'))->alias('a ')->leftJoin('content b','a.content_id=b.id')->paginate(10);

欧阳

This is a design issue. Logically speaking, users should not be allowed to delete database data.

Even if deleted, it only changes the status to deleted, and the real data still exists.

If you want to delete the data in the database, then when the user deletes this post, he must delete all the relevant data of this post.

So I still recommend you to change the status of the post. After deleting the post, another person can query the post and be prompted that the post has been deleted.

And you are the administrator, so when querying, there will be no errors due to data loss

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template