PHPackages                             imagina/ifillable-module - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. imagina/ifillable-module

ActiveLaravel-module

imagina/ifillable-module
========================

Imagina Ifilable laravel module

1.0.0(8mo ago)099361PHP

Since Jan 23Pushed 8mo ago2 watchersCompare

[ Source](https://github.com/imagina/imaginacms-ifillable)[ Packagist](https://packagist.org/packages/imagina/ifillable-module)[ RSS](/packages/imagina-ifillable-module/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (1)

imaginacms-ifillable
====================

[](#imaginacms-ifillable)

Implementation with Modules
---------------------------

[](#implementation-with-modules)

### In the Entity (Models/Entity)

[](#in-the-entity-modelsentity)

- Add Events

```
 public $dispatchesEventsWithBindings = [
        'created' => [
            ['path' => 'Modules\Ifillable\Events\CreateField']
        ],
        'creating' => [],
        'updated' => [
            ['path' => 'Modules\Ifillable\Events\CreateField']
        ],
        'updating' => [],
        'deleting' => [
            ['path' => 'Modules\Ifillable\Events\CreateField']
        ],
        'deleted' => []
    ];
```

- Add relation:

```
public function fields()
    {
        if (isModuleEnabled('Ifillable')) {
            return app(\Modules\Ifillable\Relations\FillablesRelation::class)->resolve($this);
        }
        return new \Imagina\Icore\Relations\EmptyRelation();
    }
```

### In Transformer (Transformers/EntityTransformer)

[](#in-transformer--transformersentitytransformer)

- Add relation with fields
- Instead of returning the full fields relationship as an array of objects, the transformer extracts each field's value and exposes it directly at the top level of the API response.

```
public function modelAttributes($request):array
  {
      $attributes = [];

      if ($this->resource->relationLoaded('fields')) {
          $translations = [];
          $currentLocale = app()->getLocale();

          foreach ($this->resource->fields as $field) {
              $isMultilang = false;
              $fieldTitle = $field->title;

              foreach ($field->getAttributes() as $locale => $data) {
                  if (is_array($data) && isset($data['value'])) {
                      $translations[$locale][$fieldTitle] = $data['value'];
                      $isMultilang = true;
                  }
              }

              if ($isMultilang) {
                  $attributes[$fieldTitle] = $translations[$currentLocale][$fieldTitle] ?? null;
              } else {
                  $attributes[$fieldTitle] = $field->value;
              }
          }

          $attributes = array_merge($attributes, $translations);
      }

      return $attributes;
  }
```

- Even though the fields relationship is not shown in the final response, it must be loaded (-&gt;with('fields')) for this logic to work. Otherwise, the transformer cannot access the field data. To hide the fields array from the output while still using its data, the transformer defines:

```
protected array $excludeRelations = ['fields'];
```

### Extra

[](#extra)

- It is also necessary to create records for each entity and add the extra fields that they must handle so that the relationship can generate its relationship with its respective data.

```
class ModelFillable extends CoreModel
```

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance60

Regular maintenance activity

Popularity17

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~74 days

Total

4

Last Release

255d ago

Major Versions

1.0.0 → v12.x-dev2025-09-04

PHP version history (2 changes)v10.x-devPHP ^8.1

v8.x-devPHP &gt;=7.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/2bc4bd5d733cfbe7e145670fbb1539bdb8d33f43c2cca4f26a119d37dfbad62f?d=identicon)[imagina](/maintainers/imagina)

---

Top Contributors

[![JCEC007](https://avatars.githubusercontent.com/u/7571125?v=4)](https://github.com/JCEC007 "JCEC007 (10 commits)")[![msolanogithub](https://avatars.githubusercontent.com/u/38920570?v=4)](https://github.com/msolanogithub "msolanogithub (6 commits)")[![CristianMarin19](https://avatars.githubusercontent.com/u/54483189?v=4)](https://github.com/CristianMarin19 "CristianMarin19 (5 commits)")[![imagina](https://avatars.githubusercontent.com/u/758247?v=4)](https://github.com/imagina "imagina (4 commits)")[![msolanoimagina](https://avatars.githubusercontent.com/u/121646384?v=4)](https://github.com/msolanoimagina "msolanoimagina (3 commits)")[![odchunzag](https://avatars.githubusercontent.com/u/43626463?v=4)](https://github.com/odchunzag "odchunzag (1 commits)")

### Embed Badge

![Health badge](/badges/imagina-ifillable-module/health.svg)

```
[![Health](https://phpackages.com/badges/imagina-ifillable-module/health.svg)](https://phpackages.com/packages/imagina-ifillable-module)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
