# fluent-cart/1.7.0/app/Http/Controllers/FrontendControllers/BaseFrontendController.php

FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler, version 1.7.0. 30 lines.

- Page: https://pluginprobe.com/plugins/fluent-cart/1.7.0/code/app/Http/Controllers/FrontendControllers/BaseFrontendController.php
- Raw: https://pluginprobe.com/plugins/fluent-cart/1.7.0/raw/app/Http/Controllers/FrontendControllers/BaseFrontendController.php
- Modified: 2026-09-29T12:49:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/fluent-cart/1.7.0/code/app/Http/Controllers/FrontendControllers/BaseFrontendController.php#L10-L20`.

```php
<?php

namespace FluentCart\App\Http\Controllers\FrontendControllers;

use FluentCart\Api\Resource\CustomerResource;
use FluentCart\App\Http\Controllers\Controller;
use FluentCart\App\Services\CustomerIdentity\EmailVerificationService;

class BaseFrontendController extends Controller
{
    /**
     * Check if the user is logged in.
     *
     * @return \WP_REST_Response|null Returns an error response if the user is not logged in; otherwise, returns null.
     */
    protected function checkUserLoggedIn(): ?\WP_REST_Response
    {
        $customer = CustomerResource::getCurrentCustomer(!EmailVerificationService::isEnabled());
        // Check if the user is logged in, return an error if not
        if (empty($customer)) {
            return $this->sendError([
                'message' => __('You are not logged in', 'fluent-cart')
            ]);
        }

        // User is logged in return null
        return null;
    }
}

```
