PHPackages                             nagibmahfuj/laravel-inertia-crud - 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. [Admin Panels](/categories/admin)
4. /
5. nagibmahfuj/laravel-inertia-crud

ActiveLibrary[Admin Panels](/categories/admin)

nagibmahfuj/laravel-inertia-crud
================================

Config-driven CRUD scaffolding for Laravel + Inertia.js (React/TypeScript) with interactive generator, built-in search, filters, sorting, export, import, and role-based permissions.

v1.1.2(1mo ago)2261MITTypeScriptPHP ^8.2

Since Apr 9Pushed 1mo agoCompare

[ Source](https://github.com/nagibmahfuj/laravel-inertia-crud)[ Packagist](https://packagist.org/packages/nagibmahfuj/laravel-inertia-crud)[ RSS](/packages/nagibmahfuj-laravel-inertia-crud/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (8)Versions (14)Used By (0)

Laravel Inertia CRUD
====================

[](#laravel-inertia-crud)

[![Latest Version](https://camo.githubusercontent.com/b918ff9c69a540926b65dec0e24391f42a4ce31f3361b9adc97535b6703a7db0/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6e616769626d616866756a2f6c61726176656c2d696e65727469612d637275642e737667)](https://packagist.org/packages/nagibmahfuj/laravel-inertia-crud)[![License](https://camo.githubusercontent.com/8743293ec4b3e7411dd0f2663fe9c17ca91c803c083541731f97415166841016/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6e616769626d616866756a2f6c61726176656c2d696e65727469612d637275642e737667)](https://packagist.org/packages/nagibmahfuj/laravel-inertia-crud)

A **config-driven CRUD scaffolding** package for **Laravel + Inertia.js (React/TypeScript)**. Define your columns, fields, filters, and permissions in a single PHP config array — the package handles searching, filtering, sorting, pagination, validation, CSV export, and renders beautiful React UI components automatically.

✨ Features
----------

[](#-features)

- **Config-Driven**: Define models, columns, fields, filters, and actions in a single `resourceConfig()` array
- **Interactive Generator**: Beautiful `php artisan crud:generate` wizard with model/column auto-detection
- **Built-in Search**: Full-text search across multiple columns including relationships
- **Advanced Filters**: Select, multi-select, boolean, date, and date-range filters
- **Server-Side Sorting**: Sortable columns with direction toggle
- **CSV Export**: One-click data export with custom formatters
- **File Import**: Built-in import UI with file validation and progress
- **Role-Based Permissions**: Configurable per-resource permissions with read-only, create-only, and no-delete flags
- **Spatie Integration**: Auto-detects `spatie/laravel-permission` — zero config required
- **Lifecycle Hooks**: `beforeSave()` / `afterSave()` hooks for custom transform logic
- **Audit Columns**: Auto-sets `created_by` / `updated_by` if they exist
- **Publishable Components**: shadcn/ui-based React components you fully own and customize
- **Theming**: Runtime CSS variable customization for branding
- **Laravel 11/12/13** compatible

---

📋 Requirements
--------------

[](#-requirements)

DependencyVersionPHP^8.2Laravel11.x, 12.x, or 13.xInertia.js^1.0, ^2.0, or ^3.0React18+ / 19+Node.js18+### Frontend Prerequisites

[](#frontend-prerequisites)

Your Laravel app must have the following installed (standard in Laravel Breeze React/TypeScript starter):

- **shadcn/ui** components: `Button`, `Input`, `Select`, `Label`, `Table`, `Badge`, `Checkbox`, `Dialog`, `Calendar`, `Popover`, `Card`, `Progress`, `Separator`, `DropdownMenu`, `Command`
- **lucide-react** for icons
- **date-fns** for date formatting
- **clsx** + **tailwind-merge** for class merging
- **lodash** (for `get` utility)
- **react-day-picker** (for calendar/date range)

---

🚀 Installation
--------------

[](#-installation)

### 1. Install the package

[](#1-install-the-package)

```
composer require nagibmahfuj/laravel-inertia-crud
```

The service provider is auto-discovered.

### 2. Publish the config

[](#2-publish-the-config)

```
php artisan vendor:publish --tag=crud-config
```

This creates `config/crud.php` where you define resource permissions.

### 3. Publish frontend components

[](#3-publish-frontend-components)

```
php artisan vendor:publish --tag=crud-assets
```

This publishes:

- `resources/js/components/crud/` — All React components (ResourceIndex, ResourceForm, FormField, FilterBar, DataTable, etc.)
- `resources/js/lib/crud-theme.ts` — Dashboard theme configuration
- `resources/js/lib/crud-theme.ts` — Dashboard theme configuration

### 4. Install npm dependencies (if not already installed)

[](#4-install-npm-dependencies-if-not-already-installed)

```
npm install date-fns lodash react-day-picker
npm install -D @types/lodash
```

### 5. Install required shadcn/ui components (if not already installed)

[](#5-install-required-shadcnui-components-if-not-already-installed)

```
npx shadcn@latest add button input label select table badge checkbox dialog calendar popover card progress separator dropdown-menu textarea command
```

Note

If you get installation error for shadcn/ui components, please follow below steps:

- Destroy any rogue pnpm lock or workspace files in your current directory `rm -f pnpm-lock.yaml pnpm-workspace.yaml`
- Hardcode 'npm' as your package manager inside package.json `npm pkg set packageManager="npm@10.8.0"`
- Now run the shadcn command again!

---

⚡ Quick Start — Interactive Generator
-------------------------------------

[](#-quick-start--interactive-generator)

The fastest way to create a new CRUD resource:

```
php artisan crud:generate
```

This launches a step-by-step wizard that:

1. **Scans your models** from `app/Models/` and lets you pick one
2. **Suggests a route prefix** (e.g., `products`)
3. **Suggests a page prefix** (e.g., `Dashboard/Products`)
4. **Detects database columns** from your table schema, mapping types automatically
5. **Lets you choose** what to generate (controller, policy, pages, config)
6. **Shows a summary** and generates all files

### Non-Interactive Mode

[](#non-interactive-mode)

```
# Generate everything for a model
php artisan crud:generate --model=Product --all

# Just the controller
php artisan crud:generate --model=Product --route-prefix=products

# Controller + policy with overwrite
php artisan crud:generate --model=Product --policy --force

# Custom controller namespace
php artisan crud:generate --model=Product --all --controller-namespace="App\Http\Controllers\Admin"
```

### All CLI Options

[](#all-cli-options)

OptionDescription`--model`, `-M`Model class name (e.g., `Product`)`--route-prefix`Route URL prefix (e.g., `products`)`--page-prefix`Inertia page directory (e.g., `Dashboard/Products`)`--controller-namespace`Controller namespace`--policy`Also generate a policy`--pages`Also generate Inertia TSX pages`--permissions`Also add entry to crud config`--all`Generate everything (controller + policy + pages + config)`--force`Overwrite existing files---

📖 Manual Setup (Step by Step)
-----------------------------

[](#-manual-setup-step-by-step)

### Step 1: Create Your Model

[](#step-1-create-your-model)

```
php artisan make:model Product -m
```

### Step 2: Create a Controller

[](#step-2-create-a-controller)

```
