PHPackages                             sajtiii/laravel-lockable-attributes - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. sajtiii/laravel-lockable-attributes

ActivePackage[Validation &amp; Sanitization](/categories/validation)

sajtiii/laravel-lockable-attributes
===================================

Lock your eloquent model attributes to prevent changes on them.

2.0.0(11mo ago)0517[3 PRs](https://github.com/sajtiii/laravel-lockable-attributes/pulls)MITPHPPHP ^8.2CI passing

Since Nov 6Pushed 1w ago1 watchersCompare

[ Source](https://github.com/sajtiii/laravel-lockable-attributes)[ Packagist](https://packagist.org/packages/sajtiii/laravel-lockable-attributes)[ RSS](/packages/sajtiii-laravel-lockable-attributes/feed)WikiDiscussions main Synced 3d ago

READMEChangelog (2)Dependencies (8)Versions (8)Used By (0)

Lockable Attributes for Laravel Models
======================================

[](#lockable-attributes-for-laravel-models)

This package allows you to easily lock model attributes preventing them from a sudden override.

Usage
-----

[](#usage)

1. Setup database
    Add a json column to your database table named however you want, but preferably `locked_attributes`.

```
Schema::create('my_models', function (Blueprint $table) {
    ...
    $table->json('locked_attributes');
    ...
});
```

2. Prepare your model
    Add the `HasLockedAttributes` interface and `InteractsWithLockedAttributes` trait to your model:

```
use Sajtiii\LockableAttributes\Concerns\InteractsWithLockedAttributes;
use Sajtiii\LockableAttributes\Contracts\HasLockedAttributes;

class MyModel extends Model implements HasLockedAttributes
{
    use InteractsWithLockedAttributes;

    ...
}
```

3. Define which attributes can be locked.
    Add the `getLockableAttributes()` method to your model:

```
class MyModel extends Model implements HasLockedAttributes
{
    use InteractsWithLockedAttributes;

    public function getLockableAttributes(): array
    {
        return [
            'name',
            'title',
            ...
        ];
    }
```

Filament support
----------------

[](#filament-support)

This package also comes with a form action for [Filament](https://filamentphp.com/), that can be added to form components allowing you to easily lock attributes on the resource page.

*Limitations: This action currently can only be used on the view page of the resource.*

Example (Adding the toggle action to a `TextInput`):

```
use Filament\Forms\Components\TextInput;
use Sajtiii\LockableAttributes\Contracts\HasLockedAttributes;
use Sajtiii\LockableAttributes\Filament\Forms\Actions\ToggleAttributeLockAction;

TextInput::make('name')
    ->suffixAction(ToggleAttributeLockAction::make('lock'))
    ->disabled(fn (?HasLockedAttributes $record) => $record && $record->isAttributeLocked($this->getStatePath(false))),
```

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance78

Regular maintenance activity

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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 ~266 days

Total

2

Last Release

339d ago

Major Versions

1.0.0 → 2.0.02025-07-31

PHP version history (2 changes)1.0.0PHP ^8.1

2.0.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/49076408?v=4)[Attila Tamás Nagy](/maintainers/sajtiii)[@sajtiii](https://github.com/sajtiii)

---

Top Contributors

[![sajtiii](https://avatars.githubusercontent.com/u/49076408?v=4)](https://github.com/sajtiii "sajtiii (11 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (5 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (3 commits)")[![ringattila](https://avatars.githubusercontent.com/u/166022255?v=4)](https://github.com/ringattila "ringattila (3 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/sajtiii-laravel-lockable-attributes/health.svg)

```
[![Health](https://phpackages.com/badges/sajtiii-laravel-lockable-attributes/health.svg)](https://phpackages.com/packages/sajtiii-laravel-lockable-attributes)
```

###  Alternatives

[statamic-rad-pack/runway

Eloquently manage your database models in Statamic.

135224.7k7](/packages/statamic-rad-pack-runway)[api-platform/laravel

API Platform support for Laravel

58171.6k14](/packages/api-platform-laravel)[ecotone/laravel

Ecotone for Laravel — CQRS, Event Sourcing, Sagas, Durable Workflows, and Outbox on top of Laravel Queue, via PHP attributes.

21318.6k3](/packages/ecotone-laravel)[duncanmcclean/statamic-cargo

Comprehensive e-commerce addon for Statamic. Build bespoke e-commerce sites without the complexity.

3417.0k](/packages/duncanmcclean-statamic-cargo)[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1043.3k6](/packages/carsdotcom-laravel-json-schema)

PHPackages © 2026

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