Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 0 additions & 48 deletions app/Http/Controllers/DeveloperOnboardingController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,11 @@
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Validation\Rule;
use Illuminate\View\View;

class DeveloperOnboardingController extends Controller
{
public function __construct(protected StripeConnectService $stripeConnectService) {}

public function show(Request $request): View|RedirectResponse
{
$user = $request->user();
$developerAccount = $user->developerAccount;

if ($developerAccount && $developerAccount->hasCompletedOnboarding() && $developerAccount->hasAcceptedCurrentTerms()) {
return to_route('customer.developer.dashboard')
->with('message', 'Your developer account is already set up.');
}

return view('customer.developer.onboarding', [
'developerAccount' => $developerAccount,
'hasExistingAccount' => $developerAccount !== null,
]);
}

public function start(Request $request): RedirectResponse
{
$request->validate([
Expand Down Expand Up @@ -131,35 +114,4 @@ public function refresh(Request $request): RedirectResponse
->with('error', 'Unable to refresh onboarding. Please try again.');
}
}

public function dashboard(Request $request): View|RedirectResponse
{
$user = $request->user();
$developerAccount = $user->developerAccount;

if (! $developerAccount || ! $developerAccount->hasCompletedOnboarding()) {
return to_route('customer.developer.onboarding');
}

$this->stripeConnectService->refreshAccountStatus($developerAccount);

$plugins = $user->plugins()->withCount('licenses')->get();
$payouts = $developerAccount->payouts()->with('pluginLicense.plugin')->latest()->limit(10)->get();

$totalEarnings = $developerAccount->payouts()
->where('status', 'transferred')
->sum('developer_amount');

$pendingEarnings = $developerAccount->payouts()
->where('status', 'pending')
->sum('developer_amount');

return view('customer.developer.dashboard', [
'developerAccount' => $developerAccount,
'plugins' => $plugins,
'payouts' => $payouts,
'totalEarnings' => $totalEarnings,
'pendingEarnings' => $pendingEarnings,
]);
}
}
Loading
Loading