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(9mo ago)0517[3 PRs](https://github.com/sajtiii/laravel-lockable-attributes/pulls)MITPHPPHP ^8.2CI passing

Since Nov 6Pushed 1mo 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 1mo ago

READMEChangelog (2)Dependencies (8)Versions (6)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

41

—

FairBetter than 89% of packages

Maintenance76

Regular maintenance activity

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

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

285d 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://www.gravatar.com/avatar/99cf40a5fd0a273ee2d79c2f15e946cc111dd6dcca13cdad6f0f783b2316192f?d=identicon)[sajtiii](/maintainers/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

[carsdotcom/laravel-json-schema

Json Schema validation for Laravel projects

1036.7k3](/packages/carsdotcom-laravel-json-schema)

PHPackages © 2026

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