mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-22 01:16:26 +02:00
Update all controllers get_model
This commit is contained in:
parent
bc622285a4
commit
27d2a6c5b2
14 changed files with 69 additions and 40 deletions
|
@ -30,6 +30,29 @@ namespace models;
|
|||
* @return array
|
||||
*/
|
||||
public function get_for_user(int $id_user, int $id)
|
||||
{
|
||||
$query = '
|
||||
SELECT * FROM `' . $this->get_table_name() . '`
|
||||
WHERE destination IN (SELECT number FROM phone WHERE id_user = :id_user)
|
||||
AND id = :id
|
||||
';
|
||||
|
||||
$params = [
|
||||
'id_user' => $id_user,
|
||||
'id' => $id,
|
||||
];
|
||||
|
||||
$receiveds = $this->_run_query($query, $params);
|
||||
return $receiveds[0] ?? [];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return all entries for a user
|
||||
* @param int $id_user : user id
|
||||
* @return array
|
||||
*/
|
||||
public function gets_for_user(int $id_user)
|
||||
{
|
||||
$query = '
|
||||
SELECT * FROM `' . $this->get_table_name() . '`
|
||||
|
@ -41,7 +64,6 @@ namespace models;
|
|||
];
|
||||
|
||||
$receiveds = $this->_run_query($query, $params);
|
||||
return $receiveds[0] ?? [];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue