PHPackages                             stolentine/macros - 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. stolentine/macros

ActiveLibrary

stolentine/macros
=================

v1.0.0(4y ago)0668PHP

Since Jul 7Pushed 4y ago1 watchersCompare

[ Source](https://github.com/stolentine/laravel-macros)[ Packagist](https://packagist.org/packages/stolentine/macros)[ RSS](/packages/stolentine-macros/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

\#Макросы

Миграции
--------

[](#миграции)

\###Типы

1. Создание типа (Enum)

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::table('', function (Blueprint $table) {
    $table->createType('claim_document_types')
        ->enum(['contract', 'act', 'ttn', 'check']);
});
```

2. Удаление типа

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::table('', function (Blueprint $table) {
    $table->dropType('claim_document_types')->ifExists();
});
```

\###Столбцы

1. Столбец с произвольным типом.

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::create('claim_documents', function (Blueprint $table) {
     $table->addColumnRaw('claim_document_types', 'type');
});
```

Удаляется как обычный столбец.

\###Кастомный уникальный индекс

1. Создание.

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::create('table', function (Blueprint $table) {
    $table->customUnique('column');
    $table->customUnique('column', 'index_name');
    $table->customUnique(['column1', 'column2']);
    $table->customUnique(['column1', 'column2'], 'index_name');

    $table->customUnique('inn')
        ->where('deleted_at', 'is', null)
        ->where('create_at', 'is', null, 'or');

    $table->customUnique('inn')
        ->whereIsNull('create_at');

    // только для deleted_at
    $table->customUnique('inn')
        ->whereDeletedAtIsNull();
});
```

\###Кастомное удаление индекса Если существует

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::create('table', function (Blueprint $table) {
    $table->customDropIndex('index_name')->ifExists();
    $table->customDropIndex(['column'])->ifExists();
    $table->customDropIndex(['column1', 'column2'])->ifExists();
});
```

### Constraint

[](#constraint)

1. Добавление

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Query\Builder;

Schema::table('table', function (Blueprint $table) {
    $table->addConstraint(['amount'])->check('amount >= 0 OR amount IS NULL');
    $table->addConstraint('table_not_negative_amount_check')->check('amount >= 0 OR amount IS NULL');

    $table->addConstraint(['amount'])->check(fn (Builder $q) => $q
        ->where(fn (Builder $q) => $q
            ->where('amount', '>=', 0)
            ->orWhereNull('amount')
        )
    );

});
```

1. Удаление

```
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

Schema::table('table', function (Blueprint $table) {
    $table->dropConstraint(['amount']);
    $table->dropConstraint('table_not_negative_amount_check');
});
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Unknown

Total

1

Last Release

1767d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a9ce8b13c588af41e62f4f87630d663d2f77bf8e4068aef861ebe34ce10b90fb?d=identicon)[stolentine](/maintainers/stolentine)

---

Top Contributors

[![stolentine](https://avatars.githubusercontent.com/u/75437860?v=4)](https://github.com/stolentine "stolentine (2 commits)")

### Embed Badge

![Health badge](/badges/stolentine-macros/health.svg)

```
[![Health](https://phpackages.com/badges/stolentine-macros/health.svg)](https://phpackages.com/packages/stolentine-macros)
```

PHPackages © 2026

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