2019-03-31 13:12:56 +08:00
|
|
|
<?php
|
|
|
|
|
2019-07-02 22:22:05 +08:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-03-31 13:12:56 +08:00
|
|
|
namespace App\Services;
|
|
|
|
|
|
|
|
use File;
|
|
|
|
use Illuminate\Support\Arr;
|
|
|
|
|
|
|
|
class Webpack
|
|
|
|
{
|
|
|
|
protected $manifest = [];
|
|
|
|
|
|
|
|
public function __construct()
|
|
|
|
{
|
|
|
|
$path = public_path('app/manifest.json');
|
|
|
|
if (File::exists($path)) {
|
|
|
|
$this->manifest = json_decode(File::get($path), true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-02 22:22:05 +08:00
|
|
|
public function __get(string $path)
|
2019-03-31 13:12:56 +08:00
|
|
|
{
|
2019-03-31 14:38:17 +08:00
|
|
|
return Arr::get($this->manifest, $path, '');
|
2019-03-31 13:12:56 +08:00
|
|
|
}
|
|
|
|
}
|