mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-01 21:00:58 +00:00
* refactor: stabilize model identities for domain migration * refactor: extract module platform context * refactor: assign models to domain contexts * refactor: extract ai platform context * refactor: extract storage platform context * refactor: extract mail platform context * refactor: extract pdf platform context * refactor: extract operations platform context * refactor: move installation into operations platform * refactor: extract money domain context * refactor: extract taxation domain context * refactor: extract catalog domain context * refactor: extract metadata domain context * refactor: extract reporting domain context * refactor: extract purchases domain context * refactor: extract receivables domain context * refactor: extract accounts domain context * refactor: complete reporting statement boundary * refactor: extract contacts domain context * refactor: extract sales domain context * refactor: remove legacy application layers * fix: migrate legacy bouncer role identities
56 lines
1.7 KiB
PHP
56 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace App\Domains\Contacts\Http\Controllers\CustomerPortal;
|
|
|
|
use App\Domains\Accounts\Models\Company;
|
|
use App\Domains\Contacts\Application\CustomerService;
|
|
use App\Domains\Contacts\Contracts\CustomerAvatarManager;
|
|
use App\Domains\Contacts\Http\Requests\CustomerPortal\CustomerProfileRequest;
|
|
use App\Domains\Contacts\Http\Resources\CustomerPortal\CustomerResource;
|
|
use App\Platform\Http\Controller;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Auth;
|
|
|
|
class ProfileController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly CustomerService $customerService,
|
|
private readonly CustomerAvatarManager $customerAvatarManager,
|
|
) {}
|
|
|
|
public function updateProfile(Company $company, CustomerProfileRequest $request)
|
|
{
|
|
$customer = Auth::guard('customer')->user();
|
|
|
|
$customer = $this->customerService->updateProfile(
|
|
customer: $customer,
|
|
attributes: $request->customerAttributes(),
|
|
shippingAddress: $request->shippingAddress(),
|
|
billingAddress: $request->billingAddress(),
|
|
);
|
|
|
|
if ((bool) $request->validated('is_customer_avatar_removed', false)) {
|
|
$this->customerAvatarManager->clear($customer);
|
|
}
|
|
|
|
$avatar = $request->file('customer_avatar');
|
|
|
|
if ($avatar) {
|
|
$this->customerAvatarManager->replace(
|
|
$customer,
|
|
$avatar->getPathname(),
|
|
$avatar->getClientOriginalName(),
|
|
);
|
|
}
|
|
|
|
return new CustomerResource($customer);
|
|
}
|
|
|
|
public function getUser(Request $request)
|
|
{
|
|
$customer = Auth::guard('customer')->user();
|
|
|
|
return new CustomerResource($customer);
|
|
}
|
|
}
|