mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-21 08:56:27 +02:00
User setting update now create setting if it doesn't exists yet instead of returning an error
This commit is contained in:
parent
9aa3eca812
commit
fb3f9425d1
3 changed files with 43 additions and 4 deletions
|
@ -27,6 +27,18 @@ namespace models;
|
|||
return $this->_update($this->get_table_name(), ['value' => $value], ['id_user' => $id_user, 'name' => $name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a user setting by his name for a user.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function get_by_name_for_user(int $id_user, string $name)
|
||||
{
|
||||
return $this->_select_one($this->get_table_name(), ['name' => $name, 'id_user' => $id_user]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return table name.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue