Skip to content

Commit

Permalink
Chore: fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ajayfroiden committed Dec 19, 2023
1 parent 8c7a457 commit 5eac6c1
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/Controllers/UpdateScriptVersionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

class UpdateScriptVersionController extends Controller
{

private $tmp_backup_dir = null;

public function __construct()
Expand All @@ -40,6 +41,7 @@ public function __construct()
private function moduleSetting($module)
{
$settingInstance = config(strtolower($module) . '.setting');

return $this->appSetting = $settingInstance::first();

}
Expand Down Expand Up @@ -402,7 +404,7 @@ public function refresh($module = null)

$response = EnvatoUpdate::curl($data);

if (! $response) {
if (!$response) {
return Reply::error('Something went wrong. Please try again.');
}

Expand Down Expand Up @@ -434,10 +436,24 @@ public function saveSupportSettings($response)

public function checkSupport($module = null)
{


$link = 'https://froiden.freshdesk.com/support/solutions/articles/43000554421-update-application-manually';

if ($module) {
$link = 'https://froiden.freshdesk.com/support/solutions/articles/43000569531-module-installation';
}

$messageUpdateManually = '<br><br> You can still update the application manually by following the documentation <a href="' . $link . '" target="_blank">Update Application Manually</a>';

if (is_null($this->appSetting->supported_until)) {
return Reply::error('Please provide the accurate purchase code initially, as we currently lack the correct information for the supported until date.' . $messageUpdateManually);
}

$supportedUntil = Carbon::parse($this->appSetting->supported_until);

if ($supportedUntil->isPast()) {
return Reply::error('Your support has been expired on <b>' . $supportedUntil->format(global_setting()->date_format ?? 'Y-m-d') . '</b>. <br> Please renew your support for one-click updates.');
return Reply::error('Your support has been expired on <b>' . $supportedUntil->format(global_setting()->date_format ?? 'Y-m-d') . '</b>. <br> Please renew your support for one-click updates.' . $messageUpdateManually);
}

return Reply::success('Update available.');
Expand All @@ -462,6 +478,7 @@ private function replaceWithModuleProductName($module, $string)
public function notify(Request $request, $module)
{
$this->appSetting->update(['notify_update' => $request->status]);

return Reply::success('Notification settings updated successfully.');
}

Expand Down

0 comments on commit 5eac6c1

Please sign in to comment.