PHPackages                             ravuthz/laravel-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. [CLI &amp; Console](/categories/cli)
4. /
5. ravuthz/laravel-crud

ActiveLibrary[CLI &amp; Console](/categories/cli)

ravuthz/laravel-crud
====================

A Laravel package providing a base controller for CRUD operations.

v1.1.5(1y ago)155MITPHPPHP ^7.4|^8.0

Since Jul 11Pushed 1y ago1 watchersCompare

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

READMEChangelog (4)Dependencies (3)Versions (9)Used By (0)

Laravel Crud Trait and Service for API
======================================

[](#laravel-crud-trait-and-service-for-api)

Install Package via Composer
----------------------------

[](#install-package-via-composer)

```
composer require ravuthz/laravel-crud
```

Usage
-----

[](#usage)

### Generate Crud Controller and Test

[](#generate-crud-controller-and-test)

```
php artisan crud --help

# Generate crud model, controller, test, request, resource
php artisan crud:generate Post --test

# Generate only crud controller
php artisan crud:controller Post

# Generate only crud controller test
php artisan crud:controller-test Post
```

### Use by follow sample PostController and PostControllerTest

[](#use-by-follow-sample-postcontroller-and-postcontrollertest)

First create:

- Create controller model, and migration via `php artisan make:model Post -mc` command
- Create request via `php artisan make:request PostRequest` command
- Create resource via `php artisan make:resource PostResource` command

Then you can use the following sample code to make it as crud controller and test.

```
// PostController.php
