PHPackages                             cerebralfart/laravel-crud-controller - 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. cerebralfart/laravel-crud-controller

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

cerebralfart/laravel-crud-controller
====================================

An easy way to do your CRUD stuff

0.3.4(3y ago)24.4k[10 issues](https://github.com/CerebralFart/laravel-crud/issues)MITPHPPHP ^8.0

Since Feb 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/CerebralFart/laravel-crud)[ Packagist](https://packagist.org/packages/cerebralfart/laravel-crud-controller)[ RSS](/packages/cerebralfart-laravel-crud-controller/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (17)Used By (0)

Laravel CRUD
============

[](#laravel-crud)

*An easy way to do your CRUD stuff*

Registering routes
------------------

[](#registering-routes)

The CRUD controller works as a RESTful resource controller, so you can use the following one-liner to register a controller.

```
Route::resource('/users', UserController::class);
```

This will register the following routes:

VerbPathActionNameGET/usersindexusers.indexGET/users/createcreateusers.createPOST/usersstoreusers.storeGET/users/{user}showusers.showGET/users/{user}/editeditusers.editPUT/users/{user}updateusers.updateDELETE/users/{user}destroyusers.destroyIf you only need some of these routes, you can use `->only`:

```
Route::resource('/users', UserController::class)
    ->only(['show', 'edit', 'update']);
```

General configuration
---------------------

[](#general-configuration)

### Optional configuration

[](#optional-configuration)

#### Disabling authentication

[](#disabling-authentication)

While not recommended, it is possible to disable the authorization. This can be done at the controller-level by setting the `$authDisabled` property to true, or by passing an array of actions on which it should be disabled.

```
class Controller extends CRUDController {
    protected bool $authDisabled = true;
    // OR
    protected array $authDisabled = ['list', 'show'];
}
```

#### Customizing authorization error messages

[](#customizing-authorization-error-messages)

The CRUDController provides default error messages for all routes, but these can be overridden if you want to provide more specific errors. The easiest way to do so is via the `$authErrors` property on the controller.

```
class Controller extends CRUDController {
    protected array $authErrors = [
        'viewAny' => 'Listing all entities is not allowed.',
    ];
}
```

Alternatively, if you require more fine-grained control of the error message displayed, we recommend customizing this in the policy class.

```
class ObjPolicy implements Policy{
    public function viewAny(?User $user){
        if ($user === null) return Response::deny("Not logged in");
        if ($user->isBanned()) return Response::deny("User is banned");
        if ($user->balance < 0) return Response::deny("No balance left");
        return Response::allow();
    }
}
```

List models
-----------

[](#list-models)

### Filtering

[](#filtering)

There are two ways to define filters in the CRUDController. All filters are defined as functions, but their interpretation depends on the argument it allows. Filtering on database level can be done by accepting a `Builder` instance, like the `filterDraft` below. You can apply any where-clause you'd like to. Alternatively, you can filter items once they are retrieved from the database, where you can interact with your models as you normally would. See the `filterHot` option below.

To activate one or more filters, simply pass their names to the `_filter` property in your request. The controller can accept multiple filters simultaneously, in which case they are applied in an AND-like manner. A default set of filters can be defined using the `defaultFilters` property on the controller. Should you want to invert a filter, e.g. retrieve all non-draft items, you can prefix the filter name in the request with an exclamation mark: `_filter=!draft`

```
use \Illuminate\Database\Eloquent\Builder;

class Controller extends CRUDController {
    public function filterDraft(Builder $builder): void {
        $builder->where('draft', true);
    }

    public function filterHot(Page $page): void {
        return $page->comments()->count() > 10;
    }
}
```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance0

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

Recently: every ~53 days

Total

16

Last Release

1152d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/81835593?v=4)[Taupe](/maintainers/Taupe)[@Taupe](https://github.com/Taupe)

---

Top Contributors

[![CerebralFart](https://avatars.githubusercontent.com/u/11133931?v=4)](https://github.com/CerebralFart "CerebralFart (59 commits)")

### Embed Badge

![Health badge](/badges/cerebralfart-laravel-crud-controller/health.svg)

```
[![Health](https://phpackages.com/badges/cerebralfart-laravel-crud-controller/health.svg)](https://phpackages.com/packages/cerebralfart-laravel-crud-controller)
```

###  Alternatives

[wireui/wireui

TallStack components

1.8k1.3M16](/packages/wireui-wireui)[livewire/volt

An elegantly crafted functional API for Laravel Livewire.

4195.3M84](/packages/livewire-volt)[ramonrietdijk/livewire-tables

Dynamic tables for models with Laravel Livewire

21147.4k](/packages/ramonrietdijk-livewire-tables)

PHPackages © 2026

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