-
Notifications
You must be signed in to change notification settings - Fork 243
Expand file tree
/
Copy pathGlobalDataStore.php
More file actions
59 lines (52 loc) · 1.14 KB
/
GlobalDataStore.php
File metadata and controls
59 lines (52 loc) · 1.14 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
namespace ProcessMaker\Models;
use Illuminate\Support\Facades\Cache;
use ProcessMaker\Nayra\Bpmn\DataStoreTrait;
use ProcessMaker\Nayra\Contracts\Bpmn\DataStoreInterface;
/**
* Application Data
*/
class GlobalDataStore implements DataStoreInterface
{
use DataStoreTrait;
/**
* Get data from store.
*
* @param $name
* @param $default
*
* @return mixed
*/
public function getData($name = null, $default = null)
{
if ($name === null) {
return Cache::store('global_variables')->get('global', []);
} else {
return Cache::store('global_variables')->get($name, $default);
}
}
/**
* Set data of the store.
*
* @param $data
*
* @return $this
*/
public function setData($data)
{
Cache::store('global_variables')->forever('global', $data);
return $this;
}
/**
* Put data to store.
*
* @param $name
* @param $data
*
* @return $this
*/
public function putData($name, $data)
{
return Cache::store('global_variables')->forever($name, $data);
}
}