-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathModel.php
More file actions
39 lines (32 loc) · 842 Bytes
/
Model.php
File metadata and controls
39 lines (32 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
// Import additionnal class into the global namespace
use \LaswitchTech\Core\Base\BaseModel;
class NotesModel extends BaseModel {
/**
* Constructor
*/
public function __construct()
{
// Call the parent constructor
parent::__construct();
// Initialize the Model
$this->init('notes');
}
/**
* Process a record
*
* @param array $record
* @return array
*/
protected function process(array $record): array
{
// Call the parent constructor
$record = parent::process($record);
// Process the JSON fields
if(!is_array($record['sharedWith'])){
$record['sharedWith'] = json_decode($record['sharedWith'] ?? "[]", true);
}
// Return the processed record
return $record;
}
}