laravel-design-pattern maintained by g4t
Description
g4t laravel design pattern (repository design pattern With some improvements)
Author
Last update
2022/03/28 13:58
(1.4.x-dev)
License
Downloads
210
Laravel Design Pattern Generator (api generator)
you can create your restful api with validation easily by using this package
and you can filter, sort and include eloquent relations based on a request

Installation:
Require this package with composer using the following command:
composer require g4t/laravel-design-pattern
php artisan vendor:publish --provider=g4t\Pattern\PatternServiceProvider
Usage
in folder config You will find jsonapi.json
This is where you will write relations, sortable columns and filterable columns
Commands:
full command
create (Model, Controller, Route And Repostitory)
php artisan repo:name User
or if you have model
php artisan repo:name User --model=User
and you can use --force command
you can create validation from database table using this command
php artisan repo:validation ModelName
Available command options:
| Command | Description |
|---|---|
--m |
Create Migration |
--model={ModelName} |
Insert model in controller if you have model |
--force |
override existing Repository |
Parameters to controlling data:
You can modify parameters in config/jsonapi.json
FILTER A QUERY BASED ON A REQUEST
/users?filter[name]=John
INCLUDING RELATIONS BASED ON A REQUEST
/users?include=posts
/users?include=posts,comments
SORTING A QUERY BASED ON A REQUEST
/users?sort=id
/users?sort=-id
TAKE DATA
/users?take=10
SKIP DATA
/users?skip=10
License
Laravel Design Pattern Generator is free software licensed under the MIT license.