laravel-crud-helper maintained by technote
Last update
2023/04/19 22:04
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2023/02/02 03:06
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2022/07/13 17:13
License
Require
- laravel/framework *
- php ^7.4|^8.0
- doctrine/dbal ^3.2
Last update
2022/07/13 17:13
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2022/07/13 17:13
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2022/02/01 09:48
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2022/01/19 13:37
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2022/01/04 05:22
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.2
Last update
2021/10/23 13:46
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/10/20 16:08
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/09/05 14:10
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/08/30 17:05
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/08/14 16:32
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/08/10 16:39
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/08/08 21:07
License
Require
- php ^7.4|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/08/06 20:42
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/08/02 22:15
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/07/28 22:17
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/07/27 22:17
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/07/22 22:22
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/07/07 22:21
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/07/01 22:26
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/06/25 18:09
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/06/25 18:09
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/06/25 18:05
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2021/05/17 15:48
License
Require
- php ^7.3|^8.0
- laravel/framework *
- doctrine/dbal ^3.1
Last update
2019/10/12 18:28
License
Require
- php ^7.2
- laravel/framework *
- doctrine/dbal ^2.9
Last update
2019/10/12 08:28
License
Require
- php ^7.2
- laravel/framework *
- doctrine/dbal ^2.9
Last update
2019/08/22 15:55
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
Last update
2019/08/21 09:01
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
Last update
2019/08/21 05:58
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
Last update
2019/08/18 13:24
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
Last update
2019/08/17 19:29
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
- technote/laravel-search-helper ^0.0.3
Last update
2019/08/17 10:37
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
- technote/laravel-search-helper ^0.0.3
Last update
2019/08/16 20:44
License
Require
- php ^7.1.3
- laravel/framework ~5.8
- doctrine/dbal ^2.9
- technote/laravel-search-helper ^0.0.3
Laravel CRUD Helper
Read this in other languages: English, 日本語.
CRUD helper for Laravel.
Table of Contents
Install
composer require technote/laravel-crud-helper
Usage
-
Implement
Crudable ContractandCrudable Trait.<?php namespace App\Models; use Eloquent; use Illuminate\Database\Eloquent\Model; use Technote\CrudHelper\Models\Contracts\Crudable as CrudableContract; use Technote\CrudHelper\Models\Traits\Crudable; /** * Class Item * @mixin Eloquent */ class Item extends Model implements CrudableContract { use Crudable; /** * @var array */ protected $guarded = [ 'id', ]; }
Routes
CRUD routes are set automatically.
> php artisan route:clear
> php artisan route:list
+--------+-----------+------------------+---------------+-----------------------------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+------------------+---------------+-----------------------------------------------------------------+------------+
| | GET|HEAD | api/items | items.index | Technote\CrudHelper\Http\Controllers\Api\CrudController@index | api |
| | POST | api/items | items.store | Technote\CrudHelper\Http\Controllers\Api\CrudController@store | api |
| | GET|HEAD | api/items/{item} | items.show | Technote\CrudHelper\Http\Controllers\Api\CrudController@show | api |
| | PUT|PATCH | api/items/{item} | items.update | Technote\CrudHelper\Http\Controllers\Api\CrudController@update | api |
| | DELETE | api/items/{item} | items.destroy | Technote\CrudHelper\Http\Controllers\Api\CrudController@destroy | api |
+--------+-----------+------------------+---------------+-----------------------------------------------------------------+------------+
Details
Validation
Some validation rules are generated by column settings automatically.
- Type
- integer
- boolean
- numeric
- date
- time
- string
- Length
- Unsigned
- Nullable
- by column name
- url
- phone
Model name
The model name used is determined by api name.
ex. test_items
- to singular:
test_item - to studly:
TestItem
=> TestItem
Config
Namespace
'App\\Models'- This library does not search recursively.
Prefix
'api'
Middleware
['api']
To Change
-
Run command to generate
config/crud-helper.php.php artisan vendor:publish --provider="Technote\CrudHelper\Providers\CrudHelperServiceProvider" --tag=config -
Edit settings.
'namespace' => 'App\\Models\\Crud', 'prefix' => 'api/v1', 'middleware' => [ 'api', 'auth', ],
Search feature
If implement Searchable, you can add search feature.
Laravel Search Helper
api/items?s=keyword