feat: implement staff management and subscription system
- Added StaffController for managing clinic staff, including listing, creating, updating, and toggling staff status. - Created ClinicStaff entity and repository for staff data handling. - Developed SubscriptionController to manage subscription plans and periods, including trial subscriptions. - Introduced SubscriptionPlan, SubscriptionPeriod, and ClinicSubscription entities for subscription management. - Implemented SubscriptionService for handling subscription logic, including trial activation and subscription creation from payments. - Added necessary repositories for subscription entities to facilitate data access and manipulation.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Sms\Repository;
|
||||
|
||||
use App\Sms\Entity\SmsWallet;
|
||||
use App\Sms\Entity\SmsWalletTransaction;
|
||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||
use Doctrine\Persistence\ManagerRegistry;
|
||||
|
||||
class SmsWalletTransactionRepository extends ServiceEntityRepository
|
||||
{
|
||||
public function __construct(ManagerRegistry $registry)
|
||||
{
|
||||
parent::__construct($registry, SmsWalletTransaction::class);
|
||||
}
|
||||
|
||||
public function findByWallet(SmsWallet $wallet, int $page = 1, int $limit = 20): array
|
||||
{
|
||||
return $this->createQueryBuilder('t')
|
||||
->where('t.wallet = :wallet')
|
||||
->setParameter('wallet', $wallet)
|
||||
->orderBy('t.id', 'DESC')
|
||||
->setFirstResult(($page - 1) * $limit)
|
||||
->setMaxResults($limit)
|
||||
->getQuery()
|
||||
->getResult();
|
||||
}
|
||||
|
||||
public function countByWallet(SmsWallet $wallet): int
|
||||
{
|
||||
return (int) $this->createQueryBuilder('t')
|
||||
->select('COUNT(t.id)')
|
||||
->where('t.wallet = :wallet')
|
||||
->setParameter('wallet', $wallet)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
}
|
||||
|
||||
public function save(SmsWalletTransaction $tx): void
|
||||
{
|
||||
$this->getEntityManager()->persist($tx);
|
||||
$this->getEntityManager()->flush();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user