PHPackages                             kerigard/laravel-data - 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. [Database &amp; ORM](/categories/database)
4. /
5. kerigard/laravel-data

AbandonedArchivedLibrary[Database &amp; ORM](/categories/database)

kerigard/laravel-data
=====================

Fill the database with required data

v1.0.2(1y ago)03MITPHPPHP ^8.0.2CI passing

Since Apr 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Kerigard/laravel-data)[ Packagist](https://packagist.org/packages/kerigard/laravel-data)[ Docs](https://github.com/kerigard/laravel-data)[ RSS](/packages/kerigard-laravel-data/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (4)Used By (0)

Fill the database with required data
====================================

[](#fill-the-database-with-required-data)

 [![Build Status](https://github.com/Kerigard/laravel-data/workflows/tests/badge.svg)](https://github.com/Kerigard/laravel-data/actions) [![Total Downloads](https://camo.githubusercontent.com/47457b9e5eb2d93e582a99fa13313d4e1ecda814c4038833adff392f5f3be65e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4b657269676172642f6c61726176656c2d64617461)](https://packagist.org/packages/Kerigard/laravel-data) [![Latest Stable Version](https://camo.githubusercontent.com/7fdc6ca20a5a7e90d7b1559808646a4b3518e2f32e852ffb4dd1ff9cd849859b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4b657269676172642f6c61726176656c2d64617461)](https://packagist.org/packages/Kerigard/laravel-data) [![License](https://camo.githubusercontent.com/ebea085b90bca96d13dd981396385a01ca50a7da75ff18c8bd69f5fac01311a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f4b657269676172642f6c61726176656c2d64617461)](https://packagist.org/packages/Kerigard/laravel-data)

This package adds an alternative way to populate the database regarding migrations and seeders.

Installation
------------

[](#installation)

Install package via composer:

```
composer require kerigard/laravel-data
```

Usage
-----

[](#usage)

Implement the `MustFillData` interface into the model and set the required data.

```
use Illuminate\Database\Eloquent\Model;
use Kerigard\LaravelData\Contracts\MustFillData;
use Kerigard\LaravelData\Data;

class Role extends Model implements MustFillData
{
    public function data(): Data
    {
        return Data::make([
            ['id' => 1, 'name' => 'Admin'],
            ['id' => 2, 'name' => 'User'],
        ]);
    }
}
```

Run artisan command.

```
php artisan db:data
```

As a result of executing the command, all unnecessary data will be deleted from the table and new ones will be inserted if they do not already exist.

You can also disable deleting existing data from the table.

```
public function data(): Data
{
    return Data::make([
        // ...
    ], false);
}
```

Use the `withoutEvents` method to disable all model events while a command is running. As a parameter, you can pass a list of events that should not be ignored.

```
class MyModel extends Model implements MustFillData
{
    public static function booted()
    {
        static::creating(function (MyModel $model) {
            $model->slug = Str::slug($model->name);
        });
    }

    public function data(): Data
    {
        return Data::make([
            // ...
        ])->withoutEvents(['eloquent.creating: '.MyModel::class]);
    }
}
```

If the model is present in the vendor package or does not exist, fill in the data in the `AppServiceProvider`.

```
use Kerigard\LaravelData\Data;
use Kerigard\LaravelData\DataManager;

public function boot()
{
    DataManager::model(VendorModel::class, fn () => Data::make([
        // ...
    ]));

    DataManager::table('role_user', fn () => Data::make([
        // ...
    ]));

    DataManager::table([
        'connection' => 'db2',
        'table' => 'permissions',
        'primaryKey' => 'id',
        'timestamps' => true,
    ], fn () => Data::make([
        // ...
    ]));
}
```

Changelog
---------

[](#changelog)

Please see the [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

MIT. Please see the [LICENSE FILE](LICENSE.md) for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance43

Moderate activity, may be stable

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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 ~153 days

Total

3

Last Release

458d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8bf41af862d8b4e4b8fee30d6a8a338395a39e303e2c04a8c9ec92d130db018f?d=identicon)[kerigard](/maintainers/kerigard)

---

Top Contributors

[![Kerigard](https://avatars.githubusercontent.com/u/46793484?v=4)](https://github.com/Kerigard "Kerigard (7 commits)")

---

Tags

laravellaravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kerigard-laravel-data/health.svg)

```
[![Health](https://phpackages.com/badges/kerigard-laravel-data/health.svg)](https://phpackages.com/packages/kerigard-laravel-data)
```

###  Alternatives

[tpetry/laravel-postgresql-enhanced

Support for many missing PostgreSQL specific features

9982.0M14](/packages/tpetry-laravel-postgresql-enhanced)[anourvalar/eloquent-serialize

Laravel Query Builder (Eloquent) serialization

11320.2M21](/packages/anourvalar-eloquent-serialize)[biiiiiigmonster/hasin

Laravel framework relation has in implement

154552.4k](/packages/biiiiiigmonster-hasin)[dragon-code/laravel-deploy-operations

Performing any actions during the deployment process

240173.5k2](/packages/dragon-code-laravel-deploy-operations)[bavix/laravel-clickhouse

Eloquent model for ClickHouse

72214.1k2](/packages/bavix-laravel-clickhouse)[stayallive/laravel-eloquent-observable

Register Eloquent model event listeners just-in-time directly from the model.

2928.9k7](/packages/stayallive-laravel-eloquent-observable)

PHPackages © 2026

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