|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Support\Str; |
|
4
|
|
|
use Illuminate\Support\Carbon; |
|
5
|
|
|
use Illuminate\Support\HtmlString; |
|
6
|
|
|
use Illuminate\Container\Container; |
|
7
|
|
|
use Illuminate\Queue\CallQueuedClosure; |
|
8
|
|
|
use Illuminate\Contracts\Bus\Dispatcher; |
|
9
|
|
|
use Illuminate\Queue\SerializableClosure; |
|
10
|
|
|
use Illuminate\Contracts\Auth\Access\Gate; |
|
|
|
|
|
|
11
|
|
|
use Illuminate\Contracts\Support\Responsable; |
|
12
|
|
|
use Illuminate\Contracts\Routing\UrlGenerator; |
|
13
|
|
|
use Illuminate\Foundation\Bus\PendingDispatch; |
|
14
|
|
|
use Symfony\Component\HttpFoundation\Response; |
|
|
|
|
|
|
15
|
|
|
use Illuminate\Contracts\Debug\ExceptionHandler; |
|
16
|
|
|
use Illuminate\Contracts\Routing\ResponseFactory; |
|
17
|
|
|
use Illuminate\Contracts\Auth\Factory as AuthFactory; |
|
18
|
|
|
use Illuminate\Contracts\View\Factory as ViewFactory; |
|
19
|
|
|
use Illuminate\Http\Exceptions\HttpResponseException; |
|
|
|
|
|
|
20
|
|
|
use Illuminate\Contracts\Cookie\Factory as CookieFactory; |
|
21
|
|
|
use Symfony\Component\Debug\Exception\FatalThrowableError; |
|
22
|
|
|
use Illuminate\Database\Eloquent\Factory as EloquentFactory; |
|
23
|
|
|
use Illuminate\Contracts\Validation\Factory as ValidationFactory; |
|
24
|
|
|
use Illuminate\Contracts\Broadcasting\Factory as BroadcastFactory; |
|
25
|
|
|
use Illuminate\Support\Facades\DB; |
|
26
|
|
|
|
|
27
|
|
|
if (!function_exists('version')) { |
|
28
|
|
|
function version() |
|
29
|
|
|
{ |
|
30
|
|
|
$version=new Version( |
|
31
|
|
|
'0.0.0', |
|
32
|
|
|
base_path() |
|
33
|
|
|
); |
|
34
|
|
|
return $version->getVersion(); |
|
35
|
|
|
} |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
if (!function_exists('getCustomUrl')) { |
|
39
|
|
|
function getCustomUrl() |
|
40
|
|
|
{ |
|
41
|
|
|
$customUrlCached=Cache::tags(['custom'])->get('url'); |
|
42
|
|
|
|
|
43
|
|
|
if($customUrlCached==null) { |
|
44
|
|
|
$urls=DB::table("custom_url")->where(["available"=>1])->get()->all(); |
|
45
|
|
|
Cache::tags(['custom'])->put('url', $urls, 1200); |
|
46
|
|
|
return $urls; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
return $customUrlCached; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
Let?s assume that you have a directory layout like this:
. |-- OtherDir | |-- Bar.php | `-- Foo.php `-- SomeDir `-- Foo.phpand let?s assume the following content of
Bar.php:If both files
OtherDir/Foo.phpandSomeDir/Foo.phpare loaded in the same runtime, you will see a PHP error such as the following:PHP Fatal error: Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.phpHowever, as
OtherDir/Foo.phpdoes not necessarily have to be loaded and the error is only triggered if it is loaded beforeOtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias: