@@ -5,38 +5,38 @@ |
||
5 | 5 | |
6 | 6 | class LicenseChecker |
7 | 7 | { |
8 | - /** |
|
9 | - * Handle an incoming request. |
|
10 | - * |
|
11 | - * @param \Illuminate\Http\Request $request |
|
12 | - * @param \Closure $next |
|
13 | - * @return mixed |
|
14 | - */ |
|
15 | - public function handle($request, Closure $next, $licenseKey = null) |
|
16 | - { |
|
8 | + /** |
|
9 | + * Handle an incoming request. |
|
10 | + * |
|
11 | + * @param \Illuminate\Http\Request $request |
|
12 | + * @param \Closure $next |
|
13 | + * @return mixed |
|
14 | + */ |
|
15 | + public function handle($request, Closure $next, $licenseKey = null) |
|
16 | + { |
|
17 | 17 | |
18 | - if ($this->validLicense($licenseKey)) { |
|
19 | - return $next($request); |
|
20 | - } |
|
21 | - else { |
|
22 | - return response()->json(['UnAuthorized' => 'Invalid Purchase Key'], 403); |
|
23 | - } |
|
18 | + if ($this->validLicense($licenseKey)) { |
|
19 | + return $next($request); |
|
20 | + } |
|
21 | + else { |
|
22 | + return response()->json(['UnAuthorized' => 'Invalid Purchase Key'], 403); |
|
23 | + } |
|
24 | 24 | |
25 | - } |
|
25 | + } |
|
26 | 26 | |
27 | - /** |
|
28 | - * Check if license key is valid |
|
29 | - * |
|
30 | - * @return boolean |
|
31 | - **/ |
|
32 | - private function validLicense($licenseKey) |
|
33 | - { |
|
27 | + /** |
|
28 | + * Check if license key is valid |
|
29 | + * |
|
30 | + * @return boolean |
|
31 | + **/ |
|
32 | + private function validLicense($licenseKey) |
|
33 | + { |
|
34 | 34 | |
35 | - $purchase = app()->envatoapi->verifyPurchase($licenseKey); |
|
36 | - if (is_array($purchase) and $purchase['status'] == 'success') { |
|
37 | - return true; |
|
38 | - } |
|
39 | - return false; |
|
35 | + $purchase = app()->envatoapi->verifyPurchase($licenseKey); |
|
36 | + if (is_array($purchase) and $purchase['status'] == 'success') { |
|
37 | + return true; |
|
38 | + } |
|
39 | + return false; |
|
40 | 40 | |
41 | - } |
|
41 | + } |
|
42 | 42 | } |
@@ -17,8 +17,7 @@ |
||
17 | 17 | |
18 | 18 | if ($this->validLicense($licenseKey)) { |
19 | 19 | return $next($request); |
20 | - } |
|
21 | - else { |
|
20 | + } else { |
|
22 | 21 | return response()->json(['UnAuthorized' => 'Invalid Purchase Key'], 403); |
23 | 22 | } |
24 | 23 |
@@ -75,7 +75,7 @@ |
||
75 | 75 | **/ |
76 | 76 | public function config($property) |
77 | 77 | { |
78 | - if(config()->has("core.{$property}")){ |
|
78 | + if (config()->has("core.{$property}")) { |
|
79 | 79 | return config()->get("core.{$property}"); |
80 | 80 | } |
81 | 81 | throw new \Exception("Property {$property} does not exist", 1); |
@@ -24,13 +24,13 @@ |
||
24 | 24 | }); |
25 | 25 | |
26 | 26 | Schema::create('customers', function (Blueprint $table) { |
27 | - $table->increments('id'); |
|
28 | - $table->string('name'); |
|
29 | - $table->string('purchaseKey'); |
|
30 | - $table->timestamp('support_ends'); |
|
31 | - $table->string('email')->unique(); |
|
32 | - $table->timestamps(); |
|
33 | - // |
|
27 | + $table->increments('id'); |
|
28 | + $table->string('name'); |
|
29 | + $table->string('purchaseKey'); |
|
30 | + $table->timestamp('support_ends'); |
|
31 | + $table->string('email')->unique(); |
|
32 | + $table->timestamps(); |
|
33 | + // |
|
34 | 34 | }); |
35 | 35 | } |
36 | 36 |
@@ -13,17 +13,17 @@ |
||
13 | 13 | */ |
14 | 14 | public function up() |
15 | 15 | { |
16 | - Schema::create('updates', function (Blueprint $table) { |
|
16 | + Schema::create('updates', function(Blueprint $table) { |
|
17 | 17 | $table->increments('id'); |
18 | 18 | $table->string('title'); |
19 | - $table->string('version',10); |
|
19 | + $table->string('version', 10); |
|
20 | 20 | $table->string('type'); |
21 | 21 | $table->text('description'); |
22 | 22 | $table->integer('downloads'); |
23 | 23 | $table->timestamps(); |
24 | 24 | }); |
25 | 25 | |
26 | - Schema::create('customers', function (Blueprint $table) { |
|
26 | + Schema::create('customers', function(Blueprint $table) { |
|
27 | 27 | $table->increments('id'); |
28 | 28 | $table->string('name'); |
29 | 29 | $table->string('purchaseKey'); |
@@ -12,9 +12,9 @@ |
||
12 | 12 | class InstallManagerController extends Controller |
13 | 13 | { |
14 | 14 | /** |
15 | - * When including this trait make sure you inject RepositoryContract as $repository |
|
16 | - * and CustomersRepository as $customers to the constructor |
|
17 | - */ |
|
15 | + * When including this trait make sure you inject RepositoryContract as $repository |
|
16 | + * and CustomersRepository as $customers to the constructor |
|
17 | + */ |
|
18 | 18 | use VerifiesPurchase; |
19 | 19 | |
20 | 20 | /** |
@@ -51,10 +51,10 @@ |
||
51 | 51 | public function getInstaller($version) |
52 | 52 | { |
53 | 53 | $response = $this->verifyPurchase(); |
54 | - if(null == $this->customer) |
|
54 | + if (null == $this->customer) |
|
55 | 55 | return $this->invalidKeyResponse(); |
56 | 56 | $install = $this->repository->config('install.resourcePath')."/install_{$version}.zip"; |
57 | - if(file_exists($install)){ |
|
57 | + if (file_exists($install)) { |
|
58 | 58 | return response()->download($install); |
59 | 59 | } |
60 | 60 |
@@ -51,8 +51,9 @@ |
||
51 | 51 | public function getInstaller($version) |
52 | 52 | { |
53 | 53 | $response = $this->verifyPurchase(); |
54 | - if(null == $this->customer) |
|
55 | - return $this->invalidKeyResponse(); |
|
54 | + if(null == $this->customer) { |
|
55 | + return $this->invalidKeyResponse(); |
|
56 | + } |
|
56 | 57 | $install = $this->repository->config('install.resourcePath')."/install_{$version}.zip"; |
57 | 58 | if(file_exists($install)){ |
58 | 59 | return response()->download($install); |
@@ -48,10 +48,10 @@ |
||
48 | 48 | public function fetchUpdate($version) |
49 | 49 | { |
50 | 50 | $this->getCustomer(); |
51 | - if(null == $this->customer) |
|
51 | + if (null == $this->customer) |
|
52 | 52 | return $this->invalidKeyResponse(); |
53 | 53 | $update = $this->repository->config('updates.updatesPath')."/update_{$version}.zip"; |
54 | - if(file_exists($update)){ |
|
54 | + if (file_exists($update)) { |
|
55 | 55 | return response()->download($update); |
56 | 56 | } |
57 | 57 |
@@ -48,8 +48,9 @@ |
||
48 | 48 | public function fetchUpdate($version) |
49 | 49 | { |
50 | 50 | $this->getCustomer(); |
51 | - if(null == $this->customer) |
|
52 | - return $this->invalidKeyResponse(); |
|
51 | + if(null == $this->customer) { |
|
52 | + return $this->invalidKeyResponse(); |
|
53 | + } |
|
53 | 54 | $update = $this->repository->config('updates.updatesPath')."/update_{$version}.zip"; |
54 | 55 | if(file_exists($update)){ |
55 | 56 | return response()->download($update); |
@@ -9,47 +9,47 @@ |
||
9 | 9 | */ |
10 | 10 | class CustomersRepository |
11 | 11 | { |
12 | - /** |
|
13 | - * Customer Model instance. |
|
14 | - * |
|
15 | - * @var mixed |
|
16 | - **/ |
|
17 | - public $customer; |
|
18 | - |
|
19 | - /** |
|
20 | - * Create a new instance of the CustomerRepository::class. |
|
21 | - **/ |
|
22 | - public function __construct(Customer $customer) |
|
23 | - { |
|
24 | - $this->customer = $customer; |
|
25 | - } |
|
12 | + /** |
|
13 | + * Customer Model instance. |
|
14 | + * |
|
15 | + * @var mixed |
|
16 | + **/ |
|
17 | + public $customer; |
|
18 | + |
|
19 | + /** |
|
20 | + * Create a new instance of the CustomerRepository::class. |
|
21 | + **/ |
|
22 | + public function __construct(Customer $customer) |
|
23 | + { |
|
24 | + $this->customer = $customer; |
|
25 | + } |
|
26 | 26 | |
27 | 27 | //end __construct() |
28 | 28 | |
29 | - /** |
|
30 | - * Find a customer by a field. |
|
31 | - * |
|
32 | - * @return mixid $this |
|
33 | - **/ |
|
34 | - public function findCustomer($key, $value) |
|
35 | - { |
|
36 | - return $this->customer->where($key, $value)->first(); |
|
37 | - } |
|
29 | + /** |
|
30 | + * Find a customer by a field. |
|
31 | + * |
|
32 | + * @return mixid $this |
|
33 | + **/ |
|
34 | + public function findCustomer($key, $value) |
|
35 | + { |
|
36 | + return $this->customer->where($key, $value)->first(); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | //end findCustomer() |
40 | 40 | |
41 | - /** |
|
42 | - * Create Customer with the received response. |
|
43 | - * |
|
44 | - * @return Customer |
|
45 | - * |
|
46 | - * @param array $data |
|
47 | - **/ |
|
48 | - public function createCustomer($data) |
|
49 | - { |
|
50 | - // TODO: Perform basic validation on the customer object before saving |
|
51 | - return $this->customer->create($data); |
|
52 | - } |
|
41 | + /** |
|
42 | + * Create Customer with the received response. |
|
43 | + * |
|
44 | + * @return Customer |
|
45 | + * |
|
46 | + * @param array $data |
|
47 | + **/ |
|
48 | + public function createCustomer($data) |
|
49 | + { |
|
50 | + // TODO: Perform basic validation on the customer object before saving |
|
51 | + return $this->customer->create($data); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | //end createCustomer() |
55 | 55 | }//end class |
@@ -4,105 +4,105 @@ |
||
4 | 4 | |
5 | 5 | class EnvatoApi |
6 | 6 | { |
7 | - /** |
|
8 | - * Envanto API bearer token. |
|
9 | - * |
|
10 | - * @var string |
|
11 | - **/ |
|
12 | - private $bearer; |
|
13 | - |
|
14 | - /** |
|
15 | - * Purchase verification endpoint. |
|
16 | - * |
|
17 | - * @var string |
|
18 | - **/ |
|
19 | - protected $url = 'https://api.envato.com/v3/market/author/sale?code='; |
|
20 | - |
|
21 | - /** |
|
22 | - * Request headers. |
|
23 | - * |
|
24 | - * @var array |
|
25 | - **/ |
|
26 | - private $headers; |
|
27 | - |
|
28 | - /** |
|
29 | - * Create EnvantoApi Instance. |
|
30 | - **/ |
|
31 | - public function __construct($bearer) |
|
32 | - { |
|
33 | - $this->bearer = $bearer; |
|
34 | - $this->buildHeaders(); |
|
35 | - } |
|
7 | + /** |
|
8 | + * Envanto API bearer token. |
|
9 | + * |
|
10 | + * @var string |
|
11 | + **/ |
|
12 | + private $bearer; |
|
13 | + |
|
14 | + /** |
|
15 | + * Purchase verification endpoint. |
|
16 | + * |
|
17 | + * @var string |
|
18 | + **/ |
|
19 | + protected $url = 'https://api.envato.com/v3/market/author/sale?code='; |
|
20 | + |
|
21 | + /** |
|
22 | + * Request headers. |
|
23 | + * |
|
24 | + * @var array |
|
25 | + **/ |
|
26 | + private $headers; |
|
27 | + |
|
28 | + /** |
|
29 | + * Create EnvantoApi Instance. |
|
30 | + **/ |
|
31 | + public function __construct($bearer) |
|
32 | + { |
|
33 | + $this->bearer = $bearer; |
|
34 | + $this->buildHeaders(); |
|
35 | + } |
|
36 | 36 | |
37 | 37 | //end __construct() |
38 | 38 | |
39 | - /** |
|
40 | - * Make a call to the Envato API to verify purchase. |
|
41 | - * |
|
42 | - * @return mixed Guzzle\Response::getBody() |
|
43 | - * |
|
44 | - * @param string $code |
|
45 | - **/ |
|
46 | - public function getPurchaseData($code) |
|
47 | - { |
|
48 | - $ch_verify = curl_init($this->url.$code); |
|
49 | - curl_setopt($ch_verify, CURLOPT_HTTPHEADER, $this->headers); |
|
50 | - curl_setopt($ch_verify, CURLOPT_SSL_VERIFYPEER, false); |
|
51 | - curl_setopt($ch_verify, CURLOPT_RETURNTRANSFER, 1); |
|
52 | - curl_setopt($ch_verify, CURLOPT_CONNECTTIMEOUT, 5); |
|
53 | - curl_setopt($ch_verify, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); |
|
54 | - |
|
55 | - $cinit_verify_data = curl_exec($ch_verify); |
|
56 | - curl_close($ch_verify); |
|
57 | - |
|
58 | - if ($cinit_verify_data != '') { |
|
59 | - return json_decode($cinit_verify_data, true); |
|
60 | - } |
|
61 | - |
|
62 | - return [ |
|
63 | - 'error' => 'exception', |
|
64 | - 'description' => 'A server error was encountered please notify us if you see this', |
|
65 | - ]; |
|
66 | - } |
|
39 | + /** |
|
40 | + * Make a call to the Envato API to verify purchase. |
|
41 | + * |
|
42 | + * @return mixed Guzzle\Response::getBody() |
|
43 | + * |
|
44 | + * @param string $code |
|
45 | + **/ |
|
46 | + public function getPurchaseData($code) |
|
47 | + { |
|
48 | + $ch_verify = curl_init($this->url.$code); |
|
49 | + curl_setopt($ch_verify, CURLOPT_HTTPHEADER, $this->headers); |
|
50 | + curl_setopt($ch_verify, CURLOPT_SSL_VERIFYPEER, false); |
|
51 | + curl_setopt($ch_verify, CURLOPT_RETURNTRANSFER, 1); |
|
52 | + curl_setopt($ch_verify, CURLOPT_CONNECTTIMEOUT, 5); |
|
53 | + curl_setopt($ch_verify, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13) Gecko/20080311 Firefox/2.0.0.13'); |
|
54 | + |
|
55 | + $cinit_verify_data = curl_exec($ch_verify); |
|
56 | + curl_close($ch_verify); |
|
57 | + |
|
58 | + if ($cinit_verify_data != '') { |
|
59 | + return json_decode($cinit_verify_data, true); |
|
60 | + } |
|
61 | + |
|
62 | + return [ |
|
63 | + 'error' => 'exception', |
|
64 | + 'description' => 'A server error was encountered please notify us if you see this', |
|
65 | + ]; |
|
66 | + } |
|
67 | 67 | |
68 | 68 | //end getPurchaseData() |
69 | 69 | |
70 | - /** |
|
71 | - * Verify purchase. |
|
72 | - * |
|
73 | - * @return string Array |
|
74 | - * |
|
75 | - * @param string $code Purchase Code |
|
76 | - **/ |
|
77 | - public function verifyPurchase(string $code) |
|
78 | - { |
|
79 | - $purchase = []; |
|
80 | - $purchase['response'] = (object) $this->getPurchaseData($code); |
|
81 | - if ($purchase->error) { |
|
82 | - return $purchase['status'] = 'error'; |
|
83 | - } else { |
|
84 | - return $purchase['status'] = 'success'; |
|
85 | - } |
|
86 | - } |
|
70 | + /** |
|
71 | + * Verify purchase. |
|
72 | + * |
|
73 | + * @return string Array |
|
74 | + * |
|
75 | + * @param string $code Purchase Code |
|
76 | + **/ |
|
77 | + public function verifyPurchase(string $code) |
|
78 | + { |
|
79 | + $purchase = []; |
|
80 | + $purchase['response'] = (object) $this->getPurchaseData($code); |
|
81 | + if ($purchase->error) { |
|
82 | + return $purchase['status'] = 'error'; |
|
83 | + } else { |
|
84 | + return $purchase['status'] = 'success'; |
|
85 | + } |
|
86 | + } |
|
87 | 87 | |
88 | 88 | //end verifyPurchase() |
89 | 89 | |
90 | - /** |
|
91 | - * setting the header for the rest of the api. |
|
92 | - **/ |
|
93 | - protected function buildHeaders() |
|
94 | - { |
|
95 | - $headers = [ |
|
96 | - 'Content-type' => 'application/json', |
|
97 | - 'Authorization' => 'Bearer '.$this->bearer, |
|
98 | - ]; |
|
99 | - $h = []; |
|
100 | - foreach ($headers as $key => $value) { |
|
101 | - $h[] = $key.':'.$value; |
|
102 | - } |
|
103 | - |
|
104 | - $this->headers = $h; |
|
105 | - } |
|
90 | + /** |
|
91 | + * setting the header for the rest of the api. |
|
92 | + **/ |
|
93 | + protected function buildHeaders() |
|
94 | + { |
|
95 | + $headers = [ |
|
96 | + 'Content-type' => 'application/json', |
|
97 | + 'Authorization' => 'Bearer '.$this->bearer, |
|
98 | + ]; |
|
99 | + $h = []; |
|
100 | + foreach ($headers as $key => $value) { |
|
101 | + $h[] = $key.':'.$value; |
|
102 | + } |
|
103 | + |
|
104 | + $this->headers = $h; |
|
105 | + } |
|
106 | 106 | |
107 | 107 | //end buildHeaders() |
108 | 108 | }//end class |
@@ -4,68 +4,68 @@ |
||
4 | 4 | |
5 | 5 | trait VerifiesPurchase |
6 | 6 | { |
7 | - /** |
|
8 | - * Customer Entity. |
|
9 | - * |
|
10 | - * @var mixed |
|
11 | - **/ |
|
12 | - protected $customer; |
|
7 | + /** |
|
8 | + * Customer Entity. |
|
9 | + * |
|
10 | + * @var mixed |
|
11 | + **/ |
|
12 | + protected $customer; |
|
13 | 13 | |
14 | - /** |
|
15 | - * Verify validity of the purchase key and if valid create customer. |
|
16 | - **/ |
|
17 | - public function verifyPurchase() |
|
18 | - { |
|
19 | - $this->getCustomer(); |
|
20 | - if (null != $this->customer) { |
|
21 | - return $this->validKeyResponse(); |
|
22 | - } |
|
14 | + /** |
|
15 | + * Verify validity of the purchase key and if valid create customer. |
|
16 | + **/ |
|
17 | + public function verifyPurchase() |
|
18 | + { |
|
19 | + $this->getCustomer(); |
|
20 | + if (null != $this->customer) { |
|
21 | + return $this->validKeyResponse(); |
|
22 | + } |
|
23 | 23 | |
24 | - $response = app()->envatoapi->verifyPurchase(request('code')); |
|
25 | - if ('error' == $response['status']) { |
|
26 | - return $this->invalidKeyResponse(); |
|
27 | - } |
|
24 | + $response = app()->envatoapi->verifyPurchase(request('code')); |
|
25 | + if ('error' == $response['status']) { |
|
26 | + return $this->invalidKeyResponse(); |
|
27 | + } |
|
28 | 28 | |
29 | - // If we are here then the key is valid |
|
30 | - // We now create a new customer record from the envato api response |
|
31 | - $this->customer = $this->customers->createCustomer($response['response']); |
|
32 | - // After creation of customer details return the response back to the user |
|
33 | - return $this->validKeyResponse(); |
|
34 | - } |
|
29 | + // If we are here then the key is valid |
|
30 | + // We now create a new customer record from the envato api response |
|
31 | + $this->customer = $this->customers->createCustomer($response['response']); |
|
32 | + // After creation of customer details return the response back to the user |
|
33 | + return $this->validKeyResponse(); |
|
34 | + } |
|
35 | 35 | |
36 | 36 | //end verifyPurchase() |
37 | 37 | |
38 | - /** |
|
39 | - * Return invalid key response. |
|
40 | - * |
|
41 | - * @return Illuminate\Http\Response |
|
42 | - **/ |
|
43 | - protected function invalidKeyResponse() |
|
44 | - { |
|
45 | - return response()->json(['status' => 'error', 'description' => 'Invalid purchase key'], 403); |
|
46 | - } |
|
38 | + /** |
|
39 | + * Return invalid key response. |
|
40 | + * |
|
41 | + * @return Illuminate\Http\Response |
|
42 | + **/ |
|
43 | + protected function invalidKeyResponse() |
|
44 | + { |
|
45 | + return response()->json(['status' => 'error', 'description' => 'Invalid purchase key'], 403); |
|
46 | + } |
|
47 | 47 | |
48 | 48 | //end invalidKeyResponse() |
49 | 49 | |
50 | - /** |
|
51 | - * Set the customer object. |
|
52 | - **/ |
|
53 | - protected function getCustomer() |
|
54 | - { |
|
55 | - $this->customer = $this->customers->findCustomer('purchaseKey', request()->get('code')); |
|
56 | - } |
|
50 | + /** |
|
51 | + * Set the customer object. |
|
52 | + **/ |
|
53 | + protected function getCustomer() |
|
54 | + { |
|
55 | + $this->customer = $this->customers->findCustomer('purchaseKey', request()->get('code')); |
|
56 | + } |
|
57 | 57 | |
58 | 58 | //end getCustomer() |
59 | 59 | |
60 | - /** |
|
61 | - * Return a success response if the purchase key is valid. |
|
62 | - * |
|
63 | - * @return Illuminate\Http\Response json object response |
|
64 | - **/ |
|
65 | - protected function validKeyResponse() |
|
66 | - { |
|
67 | - return response()->json(['status' => 'success', 'description' => $this->customer->tojson()]); |
|
68 | - } |
|
60 | + /** |
|
61 | + * Return a success response if the purchase key is valid. |
|
62 | + * |
|
63 | + * @return Illuminate\Http\Response json object response |
|
64 | + **/ |
|
65 | + protected function validKeyResponse() |
|
66 | + { |
|
67 | + return response()->json(['status' => 'success', 'description' => $this->customer->tojson()]); |
|
68 | + } |
|
69 | 69 | |
70 | 70 | //end validKeyResponse() |
71 | 71 | } |
@@ -6,51 +6,51 @@ |
||
6 | 6 | |
7 | 7 | class ElimuswiftCoreServiceProvider extends ServiceProvider |
8 | 8 | { |
9 | - /** |
|
10 | - * Bootstrap the application services. |
|
11 | - */ |
|
12 | - public function boot() |
|
13 | - { |
|
14 | - $this->loadFiles(); |
|
15 | - } |
|
9 | + /** |
|
10 | + * Bootstrap the application services. |
|
11 | + */ |
|
12 | + public function boot() |
|
13 | + { |
|
14 | + $this->loadFiles(); |
|
15 | + } |
|
16 | 16 | |
17 | 17 | //end boot() |
18 | 18 | |
19 | - /** |
|
20 | - * Register the application services. |
|
21 | - */ |
|
22 | - public function register() |
|
23 | - { |
|
24 | - $this->mergeConfigFrom( |
|
25 | - __DIR__.'/config/core.php', |
|
26 | - 'core' |
|
27 | - ); |
|
28 | - |
|
29 | - $this->app->singleton( |
|
30 | - 'envatoapi', |
|
31 | - function () { |
|
32 | - return new EnvatoApi(env('ENVATO_SECRET')); |
|
33 | - } |
|
34 | - ); |
|
35 | - |
|
36 | - $this->app->bind('Elimuswift\Core\Repositories\Contracts\RepositoryContract', 'Elimuswift\Core\Repositories\UpdatesRepository'); |
|
37 | - } |
|
19 | + /** |
|
20 | + * Register the application services. |
|
21 | + */ |
|
22 | + public function register() |
|
23 | + { |
|
24 | + $this->mergeConfigFrom( |
|
25 | + __DIR__.'/config/core.php', |
|
26 | + 'core' |
|
27 | + ); |
|
28 | + |
|
29 | + $this->app->singleton( |
|
30 | + 'envatoapi', |
|
31 | + function () { |
|
32 | + return new EnvatoApi(env('ENVATO_SECRET')); |
|
33 | + } |
|
34 | + ); |
|
35 | + |
|
36 | + $this->app->bind('Elimuswift\Core\Repositories\Contracts\RepositoryContract', 'Elimuswift\Core\Repositories\UpdatesRepository'); |
|
37 | + } |
|
38 | 38 | |
39 | 39 | //end register() |
40 | 40 | |
41 | - /** |
|
42 | - * Load and publish app migration files. |
|
43 | - **/ |
|
44 | - protected function loadFiles() |
|
45 | - { |
|
46 | - $this->publishes( |
|
47 | - [ |
|
48 | - __DIR__.'config/core.php' => config_path('core.php'), |
|
49 | - ] |
|
50 | - ); |
|
51 | - // $this->loadMigrationsFrom(__DIR__.'/Migrations'); |
|
52 | - $this->loadRoutesFrom(__DIR__.'/routes.php'); |
|
53 | - } |
|
41 | + /** |
|
42 | + * Load and publish app migration files. |
|
43 | + **/ |
|
44 | + protected function loadFiles() |
|
45 | + { |
|
46 | + $this->publishes( |
|
47 | + [ |
|
48 | + __DIR__.'config/core.php' => config_path('core.php'), |
|
49 | + ] |
|
50 | + ); |
|
51 | + // $this->loadMigrationsFrom(__DIR__.'/Migrations'); |
|
52 | + $this->loadRoutesFrom(__DIR__.'/routes.php'); |
|
53 | + } |
|
54 | 54 | |
55 | 55 | //end loadFiles() |
56 | 56 | }//end class |
@@ -28,7 +28,7 @@ |
||
28 | 28 | |
29 | 29 | $this->app->singleton( |
30 | 30 | 'envatoapi', |
31 | - function () { |
|
31 | + function() { |
|
32 | 32 | return new EnvatoApi(env('ENVATO_SECRET')); |
33 | 33 | } |
34 | 34 | ); |