waad / generate-design-pattern
package to generate repository design pattern dev
dev-main
2023-01-23 11:40 UTC
Requires
- php: ^7.4|^8.0
- illuminate/support: ^8.12.0
This package is not auto-updated.
Last update: 2025-04-03 15:21:06 UTC
README
you can create your restful api easily by using this library
Installation:
Require this package with composer using the following command:
composer require waad/generate-design-pattern
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
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
php artisan repo:model User --c --r --m
or if you have model
php artisan repo:model User --c --r --model=User
and you can use --force
command
create validation
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.