Files
ladill-hosting/app/Services/Platform/PlatformUserResolver.php
T
isaaccladandCursor 2c9877a87c
Deploy Ladill Hosting / deploy (push) Successful in 1m29s
Add platform admin hosting API for Ladill account provisioning.
Expose authenticated service endpoints for assigning, listing, renewing, and managing hosting accounts from the platform, with tests and deploy docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-03 22:54:00 +00:00

32 lines
678 B
PHP

<?php
namespace App\Services\Platform;
use App\Models\User;
class PlatformUserResolver
{
public function resolveOrCreate(string $publicId, string $email = '', string $name = ''): ?User
{
$publicId = trim($publicId);
if ($publicId === '') {
return null;
}
$user = User::query()->where('public_id', $publicId)->first();
if ($user) {
return $user;
}
if ($email === '') {
return null;
}
return User::query()->create([
'public_id' => $publicId,
'email' => $email,
'name' => $name !== '' ? $name : $email,
]);
}
}