|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Container\Container; |
|
4
|
|
|
use LaravelZero\Framework\Contracts\Application as ApplicationContract; |
|
5
|
|
|
|
|
6
|
|
|
if (! function_exists('app')) { |
|
7
|
|
|
/** |
|
8
|
|
|
* Get the available container instance. |
|
9
|
|
|
* |
|
10
|
|
|
* @param string $make |
|
11
|
|
|
* |
|
12
|
|
|
* @return mixed|\Laravel\Lumen\Application |
|
13
|
|
|
*/ |
|
14
|
|
|
function app($make = null) |
|
15
|
|
|
{ |
|
16
|
|
|
if (is_null($make)) { |
|
17
|
|
|
return Container::getInstance(); |
|
18
|
|
|
} |
|
19
|
|
|
|
|
20
|
|
|
return Container::getInstance() |
|
21
|
|
|
->make($make); |
|
22
|
|
|
} |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
if (! function_exists('config')) { |
|
26
|
|
|
/** |
|
27
|
|
|
* Get / set the specified configuration value. |
|
28
|
|
|
* |
|
29
|
|
|
* If an array is passed as the key, we will assume you want to set an array of values. |
|
30
|
|
|
* |
|
31
|
|
|
* @param array|string $key |
|
32
|
|
|
* @param mixed $default |
|
33
|
|
|
* |
|
34
|
|
|
* @return mixed |
|
35
|
|
|
*/ |
|
36
|
|
|
function config($key = null, $default = null) |
|
37
|
|
|
{ |
|
38
|
|
|
if (is_null($key)) { |
|
39
|
|
|
return app('config'); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
if (is_array($key)) { |
|
43
|
|
|
return app('config')->set($key); |
|
44
|
|
|
} |
|
45
|
|
|
|
|
46
|
|
|
return app('config')->get($key, $default); |
|
47
|
|
|
} |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
if (! function_exists('event')) { |
|
51
|
|
|
/** |
|
52
|
|
|
* Fire an event and call the listeners. |
|
53
|
|
|
* |
|
54
|
|
|
* @param object|string $event |
|
55
|
|
|
* @param mixed $payload |
|
56
|
|
|
* @param bool $halt |
|
57
|
|
|
* |
|
58
|
|
|
* @return array|null |
|
59
|
|
|
*/ |
|
60
|
|
|
function event($event, $payload = [], $halt = false) |
|
61
|
|
|
{ |
|
62
|
|
|
return app('events')->fire($event, $payload, $halt); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
if (! function_exists('base_path')) { |
|
67
|
|
|
/** |
|
68
|
|
|
* Get the path to the base of the install. |
|
69
|
|
|
* |
|
70
|
|
|
* @param string $path |
|
71
|
|
|
* |
|
72
|
|
|
* @return string |
|
73
|
|
|
*/ |
|
74
|
|
|
function base_path($path = '') |
|
75
|
|
|
{ |
|
76
|
|
|
return app()->basePath().($path ? DIRECTORY_SEPARATOR.$path : $path); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|