https://github.com/waadmawlood/generate-design-pattern
https://github.com/waadmawlood/generate-design-pattern
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/waadmawlood/generate-design-pattern
- Owner: waadmawlood
- License: mit
- Created: 2022-08-01T14:03:06.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-23T11:40:55.000Z (over 2 years ago)
- Last Synced: 2025-01-19T04:12:46.491Z (9 months ago)
- Language: PHP
- Size: 83 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Generate Design Pattern
### you can create your restful api easily by using this library## Installation:
Require this package with composer using the following command:```sh
composer require waad/generate-design-pattern
``````sh
php artisan vendor:publish --provider=Waad\Repository\RepositoryServiceProvider
```## Usage
##### in Model
##### $fillable = ['id',....];
##### This is where you will write `sortable`, `filterable` columns##### in Model
##### $relations = ['category','post.user'];
##### This is where you will write `relations` column##### in `app\Providers\AppServiceProvider.php` file
```sh
public function boot()
{
$registrar = new \Waad\Repository\Helpers\Routing($this->app['router']);
$this->app->bind('Illuminate\Routing\ResourceRegistrar', function () use ($registrar) {
return $registrar;
});
}
```## Commands:
##### full command
```sh
php artisan repo:model User --c --r --m
```
##### or if you have model
```sh
php artisan repo:model User --c --r --model=User
```
##### and you can use `--force` command---
#### create validation
```sh
php artisan repo:validation User
```### Available command options:
Command | Description
--------- | -------
`--c` | Create Controller and linked with repository
`--m` | Create Model and linked with Controller Functions
`--model={ModelName}` | Insert model in controller if you have model
`--r` | Create apiResource Route in api.php
`--force` | override existing Repository### License
Laravel Design Pattern Generator is free software licensed under the MIT license.