|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
|-------------------------------------------------------------------------- |
|
5
|
|
|
| Create The Application |
|
6
|
|
|
|-------------------------------------------------------------------------- |
|
7
|
|
|
| |
|
8
|
|
|
| The first thing we will do is create a new Laravel application instance |
|
9
|
|
|
| which serves as the "glue" for all the components of Laravel, and is |
|
10
|
|
|
| the IoC container for the system binding all of the various parts. |
|
11
|
|
|
| |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
9 |
|
$app = new Illuminate\Foundation\Application; |
|
15
|
|
|
|
|
16
|
|
|
/* |
|
17
|
|
|
|-------------------------------------------------------------------------- |
|
18
|
|
|
| Detect The Application Environment |
|
19
|
|
|
|-------------------------------------------------------------------------- |
|
20
|
|
|
| |
|
21
|
|
|
| Laravel takes a dead simple approach to your application environments |
|
22
|
|
|
| so you can just specify a machine name for the host that matches a |
|
23
|
|
|
| given environment, then we will automatically detect it for you. |
|
24
|
|
|
| |
|
25
|
|
|
*/ |
|
26
|
|
|
|
|
27
|
|
|
$env = $app->detectEnvironment(function () { |
|
|
|
|
|
|
28
|
9 |
|
if(file_exists($env = __DIR__.'/../.env')) { |
|
29
|
|
|
return file_get_contents($env); |
|
30
|
|
|
} |
|
31
|
9 |
|
return 'production'; |
|
32
|
9 |
|
}); |
|
33
|
|
|
|
|
34
|
|
|
/* |
|
35
|
|
|
|-------------------------------------------------------------------------- |
|
36
|
|
|
| Bind Paths |
|
37
|
|
|
|-------------------------------------------------------------------------- |
|
38
|
|
|
| |
|
39
|
|
|
| Here we are binding the paths configured in paths.php to the app. You |
|
40
|
|
|
| should not be changing these here. If you need to change these you |
|
41
|
|
|
| may do so within the paths.php file and they will be bound here. |
|
42
|
|
|
| |
|
43
|
|
|
*/ |
|
44
|
|
|
|
|
45
|
9 |
|
$app->bindInstallPaths(require __DIR__.'/paths.php'); |
|
46
|
|
|
|
|
47
|
|
|
/* |
|
48
|
|
|
|-------------------------------------------------------------------------- |
|
49
|
|
|
| Load The Application |
|
50
|
|
|
|-------------------------------------------------------------------------- |
|
51
|
|
|
| |
|
52
|
|
|
| Here we will load this Illuminate application. We will keep this in a |
|
53
|
|
|
| separate location so we can isolate the creation of an application |
|
54
|
|
|
| from the actual running of the application with a given request. |
|
55
|
|
|
| |
|
56
|
|
|
*/ |
|
57
|
|
|
|
|
58
|
9 |
|
$framework = $app['path.base']. |
|
59
|
9 |
|
'/vendor/laravel/framework/src'; |
|
60
|
|
|
|
|
61
|
9 |
|
require $framework.'/Illuminate/Foundation/start.php'; |
|
62
|
|
|
|
|
63
|
|
|
/* |
|
64
|
|
|
|-------------------------------------------------------------------------- |
|
65
|
|
|
| Return The Application |
|
66
|
|
|
|-------------------------------------------------------------------------- |
|
67
|
|
|
| |
|
68
|
|
|
| This script returns the application instance. The instance is given to |
|
69
|
|
|
| the calling script so we can separate the building of the instances |
|
70
|
|
|
| from the actual running of the application and sending responses. |
|
71
|
|
|
| |
|
72
|
|
|
*/ |
|
73
|
|
|
|
|
74
|
|
|
return $app; |
|
75
|
|
|
|
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: