Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/salmanzafar949/laravel-crud-generator
A Simple Laravel Library that allows to create crud operation with a single command
https://github.com/salmanzafar949/laravel-crud-generator
composer-package larav laravel-package laravel5 php php7
Last synced: 6 days ago
JSON representation
A Simple Laravel Library that allows to create crud operation with a single command
- Host: GitHub
- URL: https://github.com/salmanzafar949/laravel-crud-generator
- Owner: salmanzafar949
- Created: 2019-06-17T10:43:51.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-05-17T03:59:51.000Z (over 2 years ago)
- Last Synced: 2024-09-23T15:31:43.205Z (10 days ago)
- Topics: composer-package, larav, laravel-package, laravel5, php, php7
- Language: PHP
- Homepage: https://packagist.org/packages/salmanzafar/laravel-crud-generator
- Size: 17.6 KB
- Stars: 24
- Watchers: 1
- Forks: 9
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- Funding: .github/FUNDING.yml
Awesome Lists containing this project
README
# Laravel CRUD Generator
A simple Laravel 5 library that allows you to create crud operations with a single command
## Installation
```
composer require salmanzafar/laravel-crud-generator
```
## Features* Controller (with all the code already written)
* Model
* Migration
* Requests
* Routes## Enable the package (Optional)
This package implements Laravel auto-discovery feature. After you install it the package provider and facade are added automatically for laravel >= 5.5.## Configuration
Publish the configuration fileThis step is required
```
php artisan vendor:publish --provider="Salman\CrudGenerator\CrudGeneratorServiceProvider"
```## Usage
After publishing the configuration file just run the below command
```
php artisan crud:generate ModelName
```Just it, Now all of your `Model Controller, Migration, routes` and `Request` will be created automatically with all the code required for basic crud operations
## Example
```angular2
php artisan crud:generate Car
```
#### CarController.php
```angular2
get();return response()->json($cars, 201);
}public function store(CarRequest $request)
{
$car = Car::create($request->all());return response()->json($car, 201);
}public function show($id)
{
$car = Car::findOrFail($id);return response()->json($car);
}public function update(CarRequest $request, $id)
{
$car = Car::findOrFail($id);
$car->update($request->all());return response()->json($car, 200);
}public function destroy($id)
{
Car::destroy($id);return response()->json(null, 204);
}
}
```#### Car.php
```angular2
bigIncrements('id');
$table->timestamps();
});
}/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cars');
}
}
```#### Routes/api.php
```angular2
Route::apiResource('cars', 'CarController');
```##### Now all of your basic apis are ready to use you can use them directly by just adding fields in your table
### Tested on php 7.3 and laravel 5.7 and also laravel 5.8
### Currently this package supports only CRUD operation for api's