testing php storm code cleanup and styling
This commit is contained in:
@@ -2,12 +2,11 @@
|
||||
|
||||
use App\Models\Application;
|
||||
use App\Models\ApplicationPreview;
|
||||
use App\Models\PrivateKey;
|
||||
use App\Models\GithubApp;
|
||||
use App\Models\Webhook;
|
||||
use App\Models\User;
|
||||
use App\Models\Team;
|
||||
use App\Models\PrivateKey;
|
||||
use App\Models\Subscription;
|
||||
use App\Models\Team;
|
||||
use App\Models\Webhook;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Str;
|
||||
@@ -40,7 +39,7 @@ Route::get('/source/github/redirect', function () {
|
||||
$github_app->private_key_id = $private_key->id;
|
||||
$github_app->save();
|
||||
return redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return general_error_handler(err: $e);
|
||||
}
|
||||
});
|
||||
@@ -56,7 +55,7 @@ Route::get('/source/github/install', function () {
|
||||
$github_app->save();
|
||||
}
|
||||
return redirect()->route('source.github.show', ['github_app_uuid' => $github_app->uuid]);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return general_error_handler(err: $e);
|
||||
}
|
||||
});
|
||||
@@ -170,7 +169,7 @@ Route::post('/source/github/events', function () {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
return general_error_handler(err: $e);
|
||||
}
|
||||
});
|
||||
@@ -178,10 +177,9 @@ Route::post('/source/github/events', function () {
|
||||
if (isCloud()) {
|
||||
Route::post('/payments/events', function () {
|
||||
try {
|
||||
|
||||
$secret = config('coolify.lemon_squeezy_webhook_secret');
|
||||
$payload = request()->collect();
|
||||
$hash = hash_hmac('sha256', $payload, $secret);
|
||||
$secret = config('coolify.lemon_squeezy_webhook_secret');
|
||||
$payload = request()->collect();
|
||||
$hash = hash_hmac('sha256', $payload, $secret);
|
||||
$signature = request()->header('X-Signature');
|
||||
|
||||
if (!hash_equals($hash, $signature)) {
|
||||
@@ -197,7 +195,7 @@ if (isCloud()) {
|
||||
$email = data_get($payload, 'data.attributes.user_email');
|
||||
$team_id = data_get($payload, 'meta.custom_data.team_id');
|
||||
if (is_null($team_id) || empty($team_id)) {
|
||||
throw new \Exception('No team_id found in webhook payload.');
|
||||
throw new Exception('No team_id found in webhook payload.');
|
||||
}
|
||||
$subscription_id = data_get($payload, 'data.id');
|
||||
$order_id = data_get($payload, 'data.attributes.order_id');
|
||||
@@ -213,7 +211,7 @@ if (isCloud()) {
|
||||
$team = Team::find($team_id);
|
||||
$found = $team->members->where('email', $email)->first();
|
||||
if (!$found->isAdmin()) {
|
||||
throw new \Exception("User {$email} is not an admin or owner of team {$team->id}.");
|
||||
throw new Exception("User {$email} is not an admin or owner of team {$team->id}.");
|
||||
}
|
||||
switch ($event) {
|
||||
case 'subscription_created':
|
||||
@@ -254,7 +252,7 @@ if (isCloud()) {
|
||||
$webhook->update([
|
||||
'status' => 'success',
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
ray($e->getMessage());
|
||||
$webhook->update([
|
||||
'status' => 'failed',
|
||||
|
||||
Reference in New Issue
Block a user