-
-
Notifications
You must be signed in to change notification settings - Fork 861
/
Copy pathConfig.php
106 lines (91 loc) · 2.41 KB
/
Config.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
<?php
namespace Yajra\DataTables\Utilities;
use Illuminate\Contracts\Config\Repository;
class Config
{
/**
* Config constructor.
*/
public function __construct(private readonly Repository $repository) {}
/**
* Check if config uses wild card search.
*/
public function isWildcard(): bool
{
return (bool) $this->repository->get('datatables.search.use_wildcards', false);
}
/**
* Check if config uses smart search.
*/
public function isSmartSearch(): bool
{
return (bool) $this->repository->get('datatables.search.smart', true);
}
/**
* Check if config uses case-insensitive search.
*/
public function isCaseInsensitive(): bool
{
return (bool) $this->repository->get('datatables.search.case_insensitive', false);
}
/**
* Check if app is in debug mode.
*/
public function isDebugging(): bool
{
return (bool) $this->repository->get('app.debug', false);
}
/**
* Get the specified configuration value.
*
* @param string $key
* @return mixed
*/
public function get($key, mixed $default = null)
{
return $this->repository->get($key, $default);
}
/**
* Set a given configuration value.
*
* @param array|string $key
* @return void
*/
public function set($key, mixed $value = null)
{
$this->repository->set($key, $value);
}
/**
* Check if dataTable config uses multi-term searching.
*/
public function isMultiTerm(): bool
{
return (bool) $this->repository->get('datatables.search.multi_term', true);
}
/**
* Check if dataTable config uses starts_with searching.
*/
public function isStartsWithSearch(): bool
{
return (bool) $this->repository->get('datatables.search.starts_with', false);
}
public function jsonOptions(): int
{
/** @var int $options */
$options = $this->repository->get('datatables.json.options', 0);
return $options;
}
public function jsonHeaders(): array
{
return (array) $this->repository->get('datatables.json.header', []);
}
/**
* Get the maximum record limit for one page.
*
* @return int The maximum limit value.
*/
public function maxLimit(): int
{
return (int) $this->repository->get('datatables.max_limit', 100);
}
}