|
1
|
|
|
<?php namespace Arcanedev\LogViewer\Providers; |
|
2
|
|
|
|
|
3
|
|
|
use Arcanedev\LogViewer\Http\Routes\LogViewerRoute; |
|
4
|
|
|
use Arcanedev\Support\Providers\RouteServiceProvider as ServiceProvider; |
|
5
|
|
|
|
|
6
|
|
|
/** |
|
7
|
|
|
* Class RouteServiceProvider |
|
8
|
|
|
* |
|
9
|
|
|
* @package Arcanedev\LogViewer\Providers |
|
10
|
|
|
* @author ARCANEDEV <[email protected]> |
|
11
|
|
|
*/ |
|
12
|
|
|
class RouteServiceProvider extends ServiceProvider |
|
13
|
|
|
{ |
|
14
|
|
|
/* ----------------------------------------------------------------- |
|
15
|
|
|
| Getters & Setters |
|
16
|
|
|
| ----------------------------------------------------------------- |
|
17
|
|
|
*/ |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Get Route attributes |
|
21
|
|
|
* |
|
22
|
|
|
* @return array |
|
23
|
|
|
*/ |
|
24
|
|
|
public function routeAttributes() |
|
25
|
|
|
{ |
|
26
|
|
|
return (array) $this->config('attributes'); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
/** |
|
30
|
|
|
* Check if routes is enabled |
|
31
|
|
|
* |
|
32
|
|
|
* @return bool |
|
33
|
|
|
*/ |
|
34
|
888 |
|
public function isEnabled() |
|
35
|
|
|
{ |
|
36
|
888 |
|
return $this->config('enabled', false); |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
/* ----------------------------------------------------------------- |
|
40
|
|
|
| Main Methods |
|
41
|
|
|
| ----------------------------------------------------------------- |
|
42
|
|
|
*/ |
|
43
|
|
|
|
|
44
|
|
|
/** |
|
45
|
|
|
* Define the routes for the application. |
|
46
|
|
|
*/ |
|
47
|
888 |
|
public function map(): void |
|
48
|
|
|
{ |
|
49
|
888 |
|
if ($this->isEnabled()) { |
|
50
|
888 |
|
static::mapRouteClasses([ |
|
|
|
|
|
|
51
|
888 |
|
LogViewerRoute::class, |
|
52
|
|
|
]); |
|
53
|
|
|
} |
|
54
|
888 |
|
} |
|
55
|
|
|
|
|
56
|
|
|
/* ----------------------------------------------------------------- |
|
57
|
|
|
| Other Methods |
|
58
|
|
|
| ----------------------------------------------------------------- |
|
59
|
|
|
*/ |
|
60
|
|
|
|
|
61
|
|
|
/** |
|
62
|
|
|
* Get config value by key |
|
63
|
|
|
* |
|
64
|
|
|
* @param string $key |
|
65
|
|
|
* @param mixed|null $default |
|
66
|
|
|
* |
|
67
|
|
|
* @return mixed |
|
68
|
|
|
*/ |
|
69
|
888 |
|
private function config($key, $default = null) |
|
70
|
|
|
{ |
|
71
|
888 |
|
return $this->app['config']->get("log-viewer.route.$key", $default); |
|
72
|
|
|
} |
|
73
|
|
|
} |
|
74
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: