mirror of
https://github.com/RaspbianFrance/raspisms.git
synced 2025-04-22 09:26:27 +02:00
update settings
This commit is contained in:
parent
a99e159b1f
commit
9b7b78b306
12 changed files with 92 additions and 52 deletions
|
@ -18,21 +18,35 @@ namespace models;
|
|||
{
|
||||
/**
|
||||
* Return array of all settings.
|
||||
* @param int $id_user : user id
|
||||
* @return array
|
||||
*/
|
||||
public function get_all(): array
|
||||
public function gets_for_user (int $id_user): array
|
||||
{
|
||||
return $this->_select('setting');
|
||||
return $this->_select('setting', ['id_user' => $id_user]);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a new setting
|
||||
* @param array $setting
|
||||
* @return bool
|
||||
*/
|
||||
public function insert (array $setting) : bool
|
||||
{
|
||||
return (bool) $this->_insert('setting', $setting);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update a setting by his name.
|
||||
*
|
||||
* @param int $id_user : user id
|
||||
* @param string $name : setting name
|
||||
* @param mixed $value
|
||||
*
|
||||
* @return int : number of modified lines
|
||||
*/
|
||||
public function update(string $name, $value): int
|
||||
public function update (int $id_user, string $name, $value): int
|
||||
{
|
||||
return $this->_update('setting', ['value' => $value], ['name' => $name]);
|
||||
return $this->_update('setting', ['value' => $value], ['id_user' => $id_user, 'name' => $name]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue