alxarafe/resource-eloquent
Eloquent ORM adapter for alxarafe/resource-controller. Implements RepositoryContract, QueryContract, and TransactionContract using Illuminate Database.
241
| Install | |
|---|---|
composer require alxarafe/resource-eloquent |
|
| Latest Version: | 0.1.2 |
| PHP: | ^8.2 |
| Laravel: | 10 · 11 · 12 |
| License: | GPL-3.0-or-later |
| Last Updated: | Apr 28, 2026 |
| Links: | GitHub · Packagist |
Maintainer: rsanjoseo
alxarafe/resource-eloquent
Eloquent ORM adapter for alxarafe/resource-controller.
Implements RepositoryContract, QueryContract, and TransactionContract using Illuminate Database.
Ecosystem
| Package | Purpose | Status |
|---|---|---|
| resource-controller | Core CRUD engine + UI components | ✅ Stable |
| resource-eloquent | Eloquent ORM adapter | ✅ Stable |
| resource-blade | Blade template renderer adapter | ✅ Stable |
| resource-twig | Twig template renderer adapter | ✅ Stable |
Installation
composer require alxarafe/resource-eloquent
This will automatically install alxarafe/resource-controller and illuminate/database.
Usage
use Alxarafe\ResourceController\AbstractResourceController;
use Alxarafe\ResourceController\Contracts\RepositoryContract;
use Alxarafe\ResourceController\Contracts\TransactionContract;
use Alxarafe\ResourceEloquent\EloquentRepository;
use Alxarafe\ResourceEloquent\EloquentTransaction;
use App\Models\Product; // Your Eloquent model
class ProductController extends AbstractResourceController
{
// ... basic controller configuration ...
protected function getRepository(string $tabId = 'default'): RepositoryContract
{
return new EloquentRepository(Product::class);
}
protected function getTransaction(): TransactionContract
{
// Get the DB connection from Laravel or Capsule
return new EloquentTransaction(\Illuminate\Support\Facades\DB::connection());
}
}
Features
- Translates declarative field filtering and querying to Eloquent queries.
- Manages pagination automatically.
- Handles simple and compound database transactions seamlessly.
- Converts Eloquent metadata directly into Resource Controller configurations.
Development
Docker
docker compose up -d
docker exec alxarafe-resources composer install
Running the CI pipeline locally
bash bin/ci_local.sh
Running tests only
bash bin/run_tests.sh
License
GPL-3.0-or-later
Related Packages
hnhdigital-os/laravel-model-change-tracking
Provides support for tracking current user against model changes for the Eloquen...
291
8
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 0.1.2 | ^8.2 | ^10.0 || | GPL-3.0-or-later | |
| v0.1.1 | ^8.2 | ^10.0 || | GPL-3.0-or-later | |
| v0.1.0 | ^8.2 | ^10.0 || | GPL-3.0-or-later |