PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.4
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.4
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 1.3.19 trunk 1.2.0 All 47 releases
fluent-cart / app / Http / Controllers / FrontendControllers / BaseFrontendController.php

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

28 lines 830 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
8 class BaseFrontendController extends Controller
9 {
10 /**
11 * Check if the user is logged in.
12 *
13 * @return \WP_REST_Response|null Returns an error response if the user is not logged in; otherwise, returns null.
14 */
15 protected function checkUserLoggedIn(): ?\WP_REST_Response
16 {
17 $customer = CustomerResource::getCurrentCustomer();
18 // Check if the user is logged in, return an error if not
19 if (empty($customer)) {
20 return $this->sendError([
21 'message' => __('You are not logged in', 'fluent-cart')
22 ]);
23 }
24
25 // User is logged in return null
26 return null;
27 }
28 }