mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-09-01 12:51:00 +00:00
chore(contacts): remove the portal controllers retaining legacy attribution
This commit is contained in:
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Contacts\Http\Controllers\CustomerPortal;
|
||||
|
||||
use App\Domains\Contacts\Contracts\CustomerPortalDashboardProvider;
|
||||
use App\Platform\Http\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CustomerPortalDashboardProvider $customerPortalDashboardProvider,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Answer with the portal dashboard figures for the signed-in contact.
|
||||
*
|
||||
* @return Response
|
||||
*/
|
||||
public function __invoke(Request $request)
|
||||
{
|
||||
return response()->json(
|
||||
$this->customerPortalDashboardProvider->get(Auth::guard('customer')->user())
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
<?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;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private readonly CustomerService $customerService,
|
||||
private readonly CustomerAvatarManager $customerAvatarManager,
|
||||
) {}
|
||||
|
||||
public function updateProfile(Company $company, CustomerProfileRequest $request)
|
||||
{
|
||||
$customer = auth('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 CustomerResource::make($customer);
|
||||
}
|
||||
|
||||
public function getUser(Request $request)
|
||||
{
|
||||
return CustomerResource::make(auth('customer')->user());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user