alxarafe/resource-eloquent

Eloquent ORM adapter for alxarafe/resource-controller. Implements RepositoryContract, QueryContract, and TransactionContract using Illuminate Database.
224
Install
composer require alxarafe/resource-eloquent
Latest Version:0.1.2
PHP:^8.2
License:GPL-3.0-or-later
Last Updated:Apr 28, 2026
Links: GitHub  ·  Packagist
Maintainer: rsanjoseo

alxarafe/resource-eloquent

PHP Version CI Tests Static Analysis PRs Welcome

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

rockeinstein/eloquent-zf2

Eloquent ORM module for Zend Framework 2

19 1
davidmpeace/immutability

A simple Laravel package that allows you to enforce immutable attributes on Eloq...

20,474 6
stevenmaguire/laravel-cache

Seamlessly adding caching to Laravel service objects

1,758 17
expressodev/laravel-codeigniter-db

Integration layer allowing use of the Laravel database library in CodeIgniter ap...

4,013 29
darrylkuhn/dialect

Provides JSON datatype support for the Eloquent ORM

245,300 126