at-core/core-repo
最新稳定版本:v1.0.0
Composer 安装命令:
composer require at-core/core-repo
包简介
A reusable core package for Laravel projects.
README 文档
README
Xây dựng lớp truy vấn cho phép query nhanh chóng, tiện lợi
#Install
composer require at-core/core-repo
Truy cập AppServiceProvider khai báo
public function register() { $this->app->bind(BaseRepositoryInterface::class, BaseRepository::class); .... các repository đăng ký khác $this->app->bind(PaymentInvoicesRepositoryInterface::class, PaymentInvoiceRepository::class); }
Tạo 1 Repository
php cli.php User
Example
Controller
<?php 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 ]); } }
Service
<?php /** * 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); } }
统计信息
- 总下载量: 379
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-16