mirror of
https://github.com/pierre42100/ComunicAPI
synced 2025-06-19 00:25:18 +00:00
Can create a frienship request
This commit is contained in:
@ -186,6 +186,28 @@ class friends {
|
||||
return count($response) > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a friendship request
|
||||
*
|
||||
* @param $userID The ID of the user creating the request
|
||||
* @param $targetID The target of the friendship request
|
||||
* @return TRUE in case of success / FALSE else
|
||||
*/
|
||||
public function send_request(int $userID, int $targetID) : bool {
|
||||
|
||||
//Prepare the insertion
|
||||
$tableName = $this->friendsTable;
|
||||
$values = array(
|
||||
"ID_personne" => $targetID,
|
||||
"ID_amis" => $userID,
|
||||
"actif" => 0
|
||||
);
|
||||
|
||||
//Try to perform the request
|
||||
return CS::get()->db->addLine($tableName, $values) == true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Check wether a user has sent a friendship
|
||||
* request to another friend
|
||||
|
Reference in New Issue
Block a user