HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/hi.naniguide.com/app/Http/Controllers/Customer/OutreachController.php
<?php

namespace App\Http\Controllers\Customer;

use App\Http\Controllers\Controller;
use App\Models\Addon;
use App\Models\OutreachCampaign;
use Illuminate\Http\RedirectResponse;
use Illuminate\View\View;

class OutreachController extends Controller
{
    public function index(): View|RedirectResponse
    {
        if (!Addon::isActive('cold-email-outreach')) {
            return redirect()->route('customer.dashboard')
                ->with('error', __('The Cold Email Outreach addon is not active.'));
        }

        $customer = auth('customer')->user();
        if (!$customer || !$customer->groupAllows('outreach.access')) {
            $message = $customer?->groupSetting('messages.access.outreach.access', $customer?->groupSetting('messages.access.default'));

            return redirect()->route('customer.dashboard')
                ->with('error', is_string($message) && trim($message) !== '' ? $message : __('You do not have access to Outreach.'));
        }

        $campaigns = OutreachCampaign::where('customer_id', $customer->id)
            ->latest()
            ->get();

        return view('customer.outreach.index', compact('campaigns'));
    }
}