I try to create a Friendship Request function. I had a button in my output.blade.php which placed into a @foreach loop.
this loop shows every user which is not my friend.
when i click on the "send friend request" button, i will that the button completely changed. i saw a tutorial on youtube where they put the php code directly in the blade file that check in every loop the DB if the values already exist in the friendship table.
I'm not able to call the DB because i get a protection exception.
i think the solution will be vue.js, but i never work with them. so my question:
how to check on the fly a table row in the database after i insert the value in my DB?
i had 3 tables:
-
users
id | email ...
-
friends
id | users_id | friends_id ...
-
friendsrequest
id | requester_id | friend_id ...
when someone click on the "send friend request" button i create a record in friendsrequest
friendsrequest
id: 69
requester_id: 9
friend_id: 12
how can i change the layout of the button after insert the friendsrequest record? or of all friendsrequest records that i send?