This commit is contained in:
ct
2025-07-02 01:08:11 +08:00
parent 209c022f1d
commit 68a47ec916
19 changed files with 503 additions and 75 deletions

View File

@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App;
use App\Models\Plan;
use App\Models\User;
use App\Models\UserPlan;
use Illuminate\Support\Facades\Auth;
@@ -64,7 +65,7 @@ public function handleGoogleCallback()
return redirect()->intended(route('home'))->with('success', "You're now logged in!");
} catch (\Exception $e) {
throw $e;
//throw $e;
$error_message = 'Google login failed. Please try again.';
if (config('app.debug')) {
$error_message = $e->getMessage();
@@ -78,10 +79,10 @@ private function setupUser($user)
{
$user_plan = UserPlan::where('user_id', $user->id)->first();
if (!$user_plan) {
if (! $user_plan) {
$user_plan = UserPlan::create([
'user_id' => $user->id,
'plan_id' => 'free',
'plan_id' => Plan::where('tier', 'free')->first()->id,
]);
}
}