PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 All 50 releases
fluent-cart / app / Http / Controllers / FrontendControllers / BaseFrontendController.php

BaseFrontendController.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.7.0, at app/Http/Controllers/FrontendControllers/BaseFrontendController.php

30 lines 940 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentCart\App\Http\Controllers\FrontendControllers;
4
5 use FluentCart\Api\Resource\CustomerResource;
6 use FluentCart\App\Http\Controllers\Controller;
7 use FluentCart\App\Services\CustomerIdentity\EmailVerificationService;
8
9 class BaseFrontendController extends Controller
10 {
11 /**
12 * Check if the user is logged in.
13 *
14 * @return \WP_REST_Response|null Returns an error response if the user is not logged in; otherwise, returns null.
15 */
16 protected function checkUserLoggedIn(): ?\WP_REST_Response
17 {
18 $customer = CustomerResource::getCurrentCustomer(!EmailVerificationService::isEnabled());
19 // Check if the user is logged in, return an error if not
20 if (empty($customer)) {
21 return $this->sendError([
22 'message' => __('You are not logged in', 'fluent-cart')
23 ]);
24 }
25
26 // User is logged in return null
27 return null;
28 }
29 }
30