Files
mareike/app/Scopes/CommonController.php
T
2026-09-29 14:35:33 +02:00

61 lines
2.3 KiB
PHP

<?php
namespace App\Scopes;
use App\Domains\Admin\Repositories\AdminParentGroupRepository;
use App\Domains\Admin\Repositories\AdminTenantRepository;
use App\Domains\Admin\Repositories\AdminUserRepository;
use App\Models\Tenant;
use App\Providers\AuthCheckProvider;
use App\Repositories\CostUnitRepository;
use App\Repositories\EstimatesRepository;
use App\Repositories\EventParticipantRepository;
use App\Repositories\EventRepository;
use App\Repositories\GlobalSettingRepository;
use App\Repositories\InvoiceRepository;
use App\Repositories\PageTextRepository;
use App\Repositories\ParticipantRefundRepository;
use App\Repositories\PaymentMethodRepository;
use App\Repositories\UserRepository;
abstract class CommonController {
protected Tenant $tenant;
protected UserRepository $users;
protected CostUnitRepository $costUnits;
protected PageTextRepository $pageTexts;
protected InvoiceRepository $invoices;
protected EventRepository $events;
protected EventParticipantRepository $eventParticipants;
protected ParticipantRefundRepository $participantRefunds;
protected EstimatesRepository $estimates;
protected PaymentMethodRepository $paymentMethods;
protected AdminUserRepository $adminUsers;
protected AdminTenantRepository $adminTenants;
protected AdminParentGroupRepository $adminParentGroups;
protected GlobalSettingRepository $globalSettings;
public function __construct() {
$this->tenant = currentTenant();
$this->users = new UserRepository();
$this->costUnits = new CostUnitRepository();
$this->pageTexts = new PageTextRepository();
$this->invoices = new InvoiceRepository();
$this->events = new EventRepository();
$this->eventParticipants = new EventParticipantRepository();
$this->participantRefunds = new ParticipantRefundRepository();
$this->estimates = new EstimatesRepository();
$this->paymentMethods = new PaymentMethodRepository();
$this->adminUsers = new AdminUserRepository();
$this->adminTenants = new AdminTenantRepository();
$this->adminParentGroups = new AdminParentGroupRepository();
$this->globalSettings = app(GlobalSettingRepository::class);
}
protected function checkAuth() {
$authCheckProvider = new AuthCheckProvider;
return $authCheckProvider->checkLoggedIn();
}
}