1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Yajra\Datatables; |
4
|
|
|
|
5
|
|
|
use Illuminate\Contracts\Config\Repository; |
6
|
|
|
|
7
|
|
|
class Config |
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* @var \Illuminate\Contracts\Config\Repository |
11
|
|
|
*/ |
12
|
|
|
private $repository; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* Config constructor. |
16
|
|
|
* |
17
|
|
|
* @param \Illuminate\Contracts\Config\Repository $repository |
18
|
|
|
*/ |
19
|
|
|
public function __construct(Repository $repository) |
20
|
|
|
{ |
21
|
|
|
$this->repository = $repository; |
22
|
|
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Check if config uses wild card search. |
26
|
|
|
* |
27
|
|
|
* @return bool |
28
|
|
|
*/ |
29
|
|
|
public function isWildcard() |
30
|
|
|
{ |
31
|
|
|
return $this->repository->get('datatables.search.use_wildcards', false); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* Check if config uses smart search. |
36
|
|
|
* |
37
|
|
|
* @return bool |
38
|
|
|
*/ |
39
|
|
|
public function isSmartSearch() |
40
|
|
|
{ |
41
|
|
|
return $this->repository->get('datatables.search.smart', true); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Check if config uses case insensitive search. |
46
|
|
|
* |
47
|
|
|
* @return bool |
48
|
|
|
*/ |
49
|
|
|
public function isCaseInsensitive() |
50
|
|
|
{ |
51
|
|
|
return $this->repository->get('datatables.search.case_insensitive', false); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* Check if app is in debug mode. |
56
|
|
|
* |
57
|
|
|
* @return bool |
58
|
|
|
*/ |
59
|
|
|
public function isDebugging() |
60
|
|
|
{ |
61
|
|
|
return $this->repository->get('app.debug', false); |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* Get the specified configuration value. |
66
|
|
|
* |
67
|
|
|
* @param string $key |
68
|
|
|
* @param mixed $default |
69
|
|
|
* @return mixed |
70
|
|
|
*/ |
71
|
|
|
public function get($key, $default = null) |
72
|
|
|
{ |
73
|
|
|
return $this->repository->get($key, $default); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* Set a given configuration value. |
78
|
|
|
* |
79
|
|
|
* @param array|string $key |
80
|
|
|
* @param mixed $value |
81
|
|
|
* @return void |
82
|
|
|
*/ |
83
|
|
|
public function set($key, $value = null) |
84
|
|
|
{ |
85
|
|
|
$this->repository->set($key, $value); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* Check if dataTable config uses multi-term searching. |
90
|
|
|
* |
91
|
|
|
* @return bool |
92
|
|
|
*/ |
93
|
|
|
public function isMultiTerm() |
94
|
|
|
{ |
95
|
|
|
return $this->repository->get('datatables.search.multi_term', true); |
96
|
|
|
} |
97
|
|
|
} |
98
|
|
|
|