PHP code example of at-core / core-repo

1. Go to this page and download the library: Download at-core/core-repo library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

at-core / core-repo example snippets


  public function register()
    {
        $this->app->bind(BaseRepositoryInterface::class, BaseRepository::class);
        .... các repository đăng ký khác
        $this->app->bind(PaymentInvoicesRepositoryInterface::class, PaymentInvoiceRepository::class);
    }



namespace Isvn\Admin\Http\Controllers\Api;

use App\Services\ResponseService;
use AtCore\CoreRepo\Helpers\ResponseHelper;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;
use Isvn\Admin\Services\PaymentInvoiceService;

class ApiAdmPaymentController extends Controller
{
    protected $paymentInvoiceService;

    public function __construct(PaymentInvoiceService $paymentInvoiceService)
    {
        $this->paymentInvoiceService = $paymentInvoiceService;
    }

    public function index(Request $request)
    {
        $paginate = $this->paymentInvoiceService->paginate($request->all());
        list($data, $meta) = ResponseHelper::getLengthAwarePaginatorData($paginate);
        
        return ResponseService::success([
            'payments'          => $data,
            'meta'              => $meta
        ]);
    }
}



/**
 * Created By PhpStorm
 * Code By : trungphuna
 * Date: 1/9/25
 */

namespace Isvn\Admin\Services;


use App\Core\Repositories\Contracts\PaymentInvoicesRepositoryInterface;
use Isvn\Admin\Entities\PaymentInvoice;

class PaymentInvoiceService
{
    protected $paymentRepository;

    public function __construct(PaymentInvoicesRepositoryInterface $paymentInvoicesRepository)
    {
        $this->paymentRepository = $paymentInvoicesRepository;
    }

    public function paginate($params)
    {
        return $this->paymentRepository->paginate($params);
    }
}
bash 
php cli.php User