PHPackages                             lakasir/has-crud-action - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. lakasir/has-crud-action

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

lakasir/has-crud-action
=======================

Has-CRUD-Action is a Laravel package that simplifies adding CRUD (Create, Read, Update, Delete) operations to your models.

03.4k—0%PHP

Since Sep 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/lakasir/has-crud-action)[ Packagist](https://packagist.org/packages/lakasir/has-crud-action)[ RSS](/packages/lakasir-has-crud-action/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Create Read Update Delete (CRUD) Action
=======================================

[](#create-read-update-delete-crud-action)

[![Latest Version on Packagist](https://camo.githubusercontent.com/9dfe680b0d98301f93785cb883589aed4389aebc5492a7c5699f36616fd3fa6a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c616b617369722f6861732d637275642d616374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lakasir/has-crud-action)[![Total Downloads](https://camo.githubusercontent.com/80ce2ad204c1bf63a396216296de6f48995591c374bf7f0eee4bd7ac2a86a054/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c616b617369722f6861732d637275642d616374696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/lakasir/has-crud-action)[![GitHub Actions](https://github.com/lakasir/has-crud-action/actions/workflows/main.yml/badge.svg)](https://github.com/lakasir/has-crud-action/actions/workflows/main.yml/badge.svg)

`has-crud-action` is a laravel package that provides CRUD actions easily.

Features
--------

[](#features)

- **CRUD** - easily create, read, update, and delete data entities.
- **Rules** - you can add the rules for your CRUD actions on the fly.
- **Magic Parameters** - magic parameters that can be used in your actions.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

You can install the package via composer:

```
composer require lakasir/has-crud-action
```

### Usage

[](#usage)

```
// in your routes file
Route::resource('suppliers', SupplierController::class);

// in your controller file
use Lakasir\HasCrudAction\Abstracts\HasCrudActionAbstract;
use App\Models\Supplier;

class SupplierController extends HasCrudActionAbstract
{
    public static string $model = Supplier::class;
}
```

### Methods

[](#methods)

`rules` the rules method allows you to add your own rules to the action.

```
public static function rules(): array
{
    return [
        'phone_number' => 'unique:suppliers,phone_number',
        'name' => 'required'
    ];
}
```

`beforeStore` the beforeStore method allows you to modify the data before it is stored.

```
public static function beforeStore($data, $model): Model
{
    $model->name = strtoupper($data['name']);

    return $model;
}
```

`beforeUpdate` the beforeUpdate method allows you to modify the data before it is updated.

```
public static function beforeUpdate($data, $model): Model
{
    $model->name = strtoupper($data['name']);

    return $model;
}
```

`beforeDestroy` the beforeDestroy method allows you to modify the data before it is destroyed.

```
public static function beforeDestroy($model): Model
{
    dd($model);

    return $model;
}
```

`response` the response method allows you to modify the response data.

```
public static function response($record)
{
    return [
        'data' => $record,
        'success' => true,
    ];
}
```

### Magic Parameters

[](#magic-parameters)

- $id - The ID of the record
- $method - The HTTP method (GET, POST, PUT, PATCH, DELETE)
- $model - The model class name
- $data - The data sent from the request
- $record - The record object associated with the action
- $action - The current method action name
- $route - The current route name

### Testing

[](#testing)

```
composer test
```

### Todo

[](#todo)

- Pagination support
- Filter support
- ModifyQuery
- Error handler for unsupported magic parameter
- Relation support
- Unit test
- Pipeline

### Changelog

[](#changelog)

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

### Contributing

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

### Security

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

### Credits

[](#credits)

- [lakasir](https://github.com/lakasir)
- [All Contributors](../../contributors)

### License

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

### Laravel Package Boilerplate

[](#laravel-package-boilerplate)

This package was generated using the [Laravel Package Boilerplate](https://laravelpackageboilerplate.com).

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity17

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/3ed1a4b2439b93f675e34da1edd32c374924e53bb2eb0843bdd727f46a9412bb?d=identicon)[sheenazien8](/maintainers/sheenazien8)

---

Top Contributors

[![sheenazien8](https://avatars.githubusercontent.com/u/37477023?v=4)](https://github.com/sheenazien8 "sheenazien8 (10 commits)")

---

Tags

laravellibrarypackage-developmentphp

### Embed Badge

![Health badge](/badges/lakasir-has-crud-action/health.svg)

```
[![Health](https://phpackages.com/badges/lakasir-has-crud-action/health.svg)](https://phpackages.com/packages/lakasir-has-crud-action)
```

PHPackages © 2026

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