g4t/laravel-design-pattern

g4t laravel design pattern (repository design pattern With some improvements)

1.4 2022-02-08 23:56 UTC

This package is auto-updated.

Last update: 2024-04-20 10:41:28 UTC


README

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

logo.png

me

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.