@@ 12-63 (lines=52) @@ | ||
9 | /** |
|
10 | * |
|
11 | */ |
|
12 | class InstallManagerController extends Controller |
|
13 | { |
|
14 | /** |
|
15 | * When including this trait make sure you inject RepositoryContract as $repository |
|
16 | * and CustomersRepository as $customers to the constructor |
|
17 | */ |
|
18 | use VerifiesPurchase; |
|
19 | ||
20 | /** |
|
21 | * Update Repository |
|
22 | * |
|
23 | * @var mixed $repository |
|
24 | **/ |
|
25 | public $repository; |
|
26 | ||
27 | /** |
|
28 | * Customers Repository |
|
29 | * |
|
30 | * @var mixed $customers |
|
31 | **/ |
|
32 | public $customers; |
|
33 | ||
34 | /** |
|
35 | * Create a new instance of the UpdatesManagerController::class |
|
36 | * |
|
37 | **/ |
|
38 | public function __construct(RepositoryContract $repository, CustomersRepository $customers) |
|
39 | { |
|
40 | $this->repository = $repository; |
|
41 | $this->customers = $customers; |
|
42 | } |
|
43 | ||
44 | /** |
|
45 | * Get the installer zip file for the version specified |
|
46 | * NOTE: The purchase key must be passed in the request for verification |
|
47 | * |
|
48 | * @return mixed Illuminate\Http\Response |
|
49 | * @param $version Version to fetch |
|
50 | **/ |
|
51 | public function getInstaller($version) |
|
52 | { |
|
53 | $response = $this->verifyPurchase(); |
|
54 | if(null == $this->customer) |
|
55 | return $this->invalidKeyResponse(); |
|
56 | $install = $this->repository->config('install.resourcePath')."/install_{$version}.zip"; |
|
57 | if(file_exists($install)){ |
|
58 | return response()->download($install); |
|
59 | } |
|
60 | ||
61 | } |
|
62 | ||
63 | } |
@@ 12-60 (lines=49) @@ | ||
9 | /** |
|
10 | * |
|
11 | */ |
|
12 | class UpdateManagerController extends Controller |
|
13 | { |
|
14 | // When including ths trait make sure you inject RepositoryContract as $repository and |
|
15 | // CustomersRepository as $customers to the constructor |
|
16 | use VerifiesPurchase; |
|
17 | ||
18 | /** |
|
19 | * Update Repository |
|
20 | * |
|
21 | * @var mixed |
|
22 | **/ |
|
23 | public $repository; |
|
24 | ||
25 | /** |
|
26 | * Customers Repository |
|
27 | * |
|
28 | * @var mixed |
|
29 | **/ |
|
30 | public $customers; |
|
31 | ||
32 | /** |
|
33 | * Create a new instance of the UpdatesManagerController::class |
|
34 | * |
|
35 | **/ |
|
36 | public function __construct(RepositoryContract $repository, CustomersRepository $customers) |
|
37 | { |
|
38 | $this->repository = $repository; |
|
39 | $this->customers = $customers; |
|
40 | } |
|
41 | ||
42 | /** |
|
43 | * |
|
44 | * |
|
45 | * @return mixed Illuminate\Http\Response |
|
46 | * @param $version Version to fetch |
|
47 | **/ |
|
48 | public function fetchUpdate($version) |
|
49 | { |
|
50 | $this->getCustomer(); |
|
51 | if(null == $this->customer) |
|
52 | return $this->invalidKeyResponse(); |
|
53 | $update = $this->repository->config('updates.updatesPath')."/update_{$version}.zip"; |
|
54 | if(file_exists($update)){ |
|
55 | return response()->download($update); |
|
56 | } |
|
57 | ||
58 | } |
|
59 | ||
60 | } |