Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Javaabu/generators
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.5.6
Choose a base ref
...
head repository: Javaabu/generators
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref

Commits on Jul 3, 2024

  1. - Simplified auth controllers

    dash8x committed Jul 3, 2024
    Copy the full SHA
    13c4bde View commit details

Commits on Jul 4, 2024

  1. Copy the full SHA
    c2ae093 View commit details
  2. Copy the full SHA
    355ef76 View commit details

Commits on Jul 5, 2024

  1. Copy the full SHA
    7c3cf10 View commit details

Commits on Jul 8, 2024

  1. Copy the full SHA
    f098036 View commit details
  2. Copy the full SHA
    5a618ef View commit details

Commits on Jul 12, 2024

  1. Copy the full SHA
    a59e3e9 View commit details

Commits on Jul 29, 2024

  1. - Fixed EOL

    - Removed hard coded DB params
    dash8x committed Jul 29, 2024
    Copy the full SHA
    1e131a8 View commit details
  2. - Refactored stub renderer

    dash8x committed Jul 29, 2024
    Copy the full SHA
    0bda9f2 View commit details
  3. - Refactored generate command

    dash8x committed Jul 29, 2024
    Copy the full SHA
    8be02ac View commit details
  4. - Refactored generator-helpers

    dash8x committed Jul 29, 2024
    Copy the full SHA
    1544fbf View commit details

Commits on Aug 20, 2024

  1. coverage test

    dash8x committed Aug 20, 2024
    Copy the full SHA
    2d31b16 View commit details
  2. Copy the full SHA
    0870fea View commit details
  3. - Removed code quality badge

    dash8x committed Aug 20, 2024
    Copy the full SHA
    f163e88 View commit details
  4. Copy the full SHA
    cd552e4 View commit details
  5. Copy the full SHA
    ee232c7 View commit details
  6. Copy the full SHA
    ac0207d View commit details
  7. - Added filter test generation

    - Added export test generation
    dash8x committed Aug 20, 2024
    Copy the full SHA
    7791c3a View commit details
  8. - Fixed test generator

    dash8x committed Aug 20, 2024
    Copy the full SHA
    fc7d21d View commit details
  9. - Fixed test generator

    dash8x committed Aug 20, 2024
    Copy the full SHA
    a07be5d View commit details

Commits on Oct 2, 2024

  1. Copy the full SHA
    7cf9f7c View commit details
  2. Copy the full SHA
    187cc30 View commit details

Commits on Jan 21, 2025

  1. Copy the full SHA
    afed151 View commit details

Commits on Feb 25, 2025

  1. - Testing Laravel 12 support

    dash8x committed Feb 25, 2025
    Copy the full SHA
    407ef90 View commit details
  2. - Changed tests stubs to use php attribute instead of docblock to add…

    … support for phpunit 12
    dash8x committed Feb 25, 2025
    Copy the full SHA
    11e926c View commit details

Commits on Mar 27, 2025

  1. Copy the full SHA
    da4a85b View commit details

Commits on Apr 16, 2025

  1. Copy the full SHA
    d88ca79 View commit details

Commits on Apr 24, 2025

  1. - Added test for custom stubs

    - Bumped generator-helpers package version
    dash8x committed Apr 24, 2025
    Copy the full SHA
    1d2aea0 View commit details

Commits on Apr 28, 2025

  1. Copy the full SHA
    0776a33 View commit details
Showing with 1,248 additions and 949 deletions.
  1. +20 −0 .github/coverage.svg
  2. +18 −4 .github/workflows/run-tests.yml
  3. +1 −0 .gitignore
  4. +0 −19 .scrutinizer.yml
  5. +0 −4 .styleci.yml
  6. +1 −1 README.md
  7. +6 −5 composer.json
  8. +1 −0 docs/advanced-usage/customising-stubs.md
  9. +6 −2 docs/basic-usage/available-generators.md
  10. +1 −0 docs/limitations/supported-drivers.md
  11. +15 −14 docs/limitations/supported-field-types.md
  12. +5 −4 phpunit.xml.dist
  13. +1 −1 src/Commands/Auth/GenerateAuthFactoryCommand.php
  14. +4 −4 src/Commands/Auth/GenerateAuthModelCommand.php
  15. +1 −1 src/Commands/Auth/GenerateAuthPermissionsCommand.php
  16. +1 −1 src/Commands/Auth/GenerateAuthPolicyCommand.php
  17. +1 −1 src/Commands/Auth/GenerateAuthRequestCommand.php
  18. +1 −1 src/Commands/GenerateApiControllerCommand.php
  19. +1 −1 src/Commands/GenerateApiTestCommand.php
  20. +2 −73 src/Commands/GenerateCommand.php
  21. +1 −1 src/Commands/GenerateControllerCommand.php
  22. +1 −1 src/Commands/GenerateExportCommand.php
  23. +1 −1 src/Commands/GenerateFactoryCommand.php
  24. +3 −3 src/Commands/GenerateModelCommand.php
  25. +2 −2 src/Commands/GeneratePermissionsCommand.php
  26. +1 −1 src/Commands/GeneratePolicyCommand.php
  27. +1 −1 src/Commands/GenerateRequestCommand.php
  28. +1 −1 src/Commands/GenerateRoutesCommand.php
  29. +1 −1 src/Commands/GenerateTestCommand.php
  30. +1 −1 src/Commands/GenerateViewsCommand.php
  31. +17 −1 src/Commands/MultipleGeneratorCommand.php
  32. +5 −0 src/FieldTypes/BooleanField.php
  33. +7 −1 src/FieldTypes/EnumField.php
  34. +15 −1 src/FieldTypes/Field.php
  35. +1 −1 src/FieldTypes/ForeignKeyField.php
  36. +5 −0 src/FieldTypes/JsonField.php
  37. +1 −1 src/Generators/Auth/AuthConfigGenerator.php
  38. +1 −1 src/Generators/Auth/AuthFactoryGenerator.php
  39. +1 −1 src/Generators/Auth/AuthPermissionsGenerator.php
  40. +1 −1 src/Generators/Auth/BaseAuthGenerator.php
  41. +2 −2 src/Generators/BaseGenerator.php
  42. +1 −1 src/Generators/Concerns/GeneratesController.php
  43. +6 −1 src/Generators/Concerns/GeneratesFactory.php
  44. +1 −1 src/Generators/Concerns/GeneratesModel.php
  45. +1 −1 src/Generators/Concerns/GeneratesRequest.php
  46. +1 −1 src/Generators/ControllerGenerator.php
  47. +1 −1 src/Generators/FactoryGenerator.php
  48. +4 −4 src/Generators/TestGenerator.php
  49. +3 −3 src/Generators/ViewsGenerator.php
  50. +3 −1 src/GeneratorsServiceProvider.php
  51. +1 −1 src/IconProviders/BaseIconProvider.php
  52. +19 −0 src/Resolvers/SchemaResolverMySql.php
  53. +0 −117 src/Support/StringCaser.php
  54. +0 −182 src/Support/StubRenderer.php
  55. +6 −26 stubs/Controllers/Auth/AuthModelSoftDeletesController.stub
  56. +0 −9 stubs/Controllers/Auth/ConfirmPasswordController.stub
  57. +0 −12 stubs/Controllers/Auth/LoginController.stub
  58. +0 −17 stubs/Controllers/Auth/RegisterController.stub
  59. +1 −8 stubs/Controllers/Auth/ResetPasswordController.stub
  60. +0 −13 stubs/Controllers/Auth/UpdatePasswordController.stub
  61. +0 −9 stubs/Controllers/Auth/VerificationController.stub
  62. +1 −7 stubs/Controllers/ModelController.stub
  63. +3 −23 stubs/Controllers/ModelSoftDeletesController.stub
  64. +5 −4 stubs/Exports/ModelExport.stub
  65. +1 −1 stubs/factories/_factoryForeignKey.stub
  66. +5 −4 stubs/tests/ModelApiControllerTest.stub
  67. +56 −17 stubs/tests/ModelControllerTest.stub
  68. +62 −23 stubs/tests/ModelSoftDeletesControllerTest.stub
  69. +1 −0 stubs/views/model-soft-deletes/_list.blade.stub
  70. +1 −0 stubs/views/model/_list.blade.stub
  71. +1 −4 stubs/views/model/model.blade.stub
  72. +28 −0 tests/Feature/Commands/GenerateAllCommandTest.php
  73. +7 −56 tests/TestCase.php
  74. +13 −0 tests/TestSupport/Enums/SingleCaseOrderStatuses.php
  75. +4 −0 tests/TestSupport/database/2024_04_28_144113_create_posts_table.php
  76. +41 −0 tests/TestSupport/database/2025_03_27_212600_create_single_value_enum_orders_table.php
  77. +2 −2 tests/Unit/FieldTest.php
  78. +36 −0 tests/Unit/Generators/BaseGeneratorTest.php
  79. +11 −0 tests/Unit/Generators/TestGeneratorTest.php
  80. +15 −15 tests/Unit/Generators/ViewsGeneratorTest.php
  81. +69 −0 tests/Unit/SchemaResolverMySqlTest.php
  82. +1 −1 tests/Unit/StringCaserTest.php
  83. +1 −1 tests/Unit/StubRendererTest.php
  84. +1 −7 tests/stubs/Controllers/CategoriesController.php
  85. +0 −9 tests/stubs/Controllers/Customer/Auth/ConfirmPasswordController.php
  86. +0 −12 tests/stubs/Controllers/Customer/Auth/LoginController.php
  87. +0 −17 tests/stubs/Controllers/Customer/Auth/RegisterController.php
  88. +1 −8 tests/stubs/Controllers/Customer/Auth/ResetPasswordController.php
  89. +0 −13 tests/stubs/Controllers/Customer/Auth/UpdatePasswordController.php
  90. +0 −9 tests/stubs/Controllers/Customer/Auth/VerificationController.php
  91. +6 −26 tests/stubs/Controllers/CustomersController.php
  92. +1 −7 tests/stubs/Controllers/OrdersController.php
  93. +3 −23 tests/stubs/Controllers/ProductsController.php
  94. +5 −4 tests/stubs/Exports/CategoriesExport.php
  95. +22 −0 tests/stubs/Exports/ModelExport.stub
  96. +22 −0 tests/stubs/Exports/ProductsExport.php
  97. +1 −1 tests/stubs/factories/OrderFactory.php
  98. +5 −4 tests/stubs/tests/Api/CategoriesControllerTest.stub
  99. +58 −17 tests/stubs/tests/CategoriesControllerTest.stub
  100. +58 −17 tests/stubs/tests/OrdersControllerTest.stub
  101. +66 −25 tests/stubs/tests/ProductsControllerTest.stub
  102. +410 −0 tests/stubs/tests/SingleValueEnumOrdersControllerTest.stub
  103. +1 −1 tests/stubs/tests/_factoryDbValues.stub
  104. +2 −2 tests/stubs/views/categories/_form.blade.php
  105. +4 −4 tests/stubs/views/orders/_form.blade.php
  106. +14 −14 tests/stubs/views/products/_form.blade.php
  107. +1 −4 tests/stubs/views/products/products.blade.php
20 changes: 20 additions & 0 deletions .github/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 18 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -16,10 +16,13 @@ jobs:
fail-fast: true
matrix:
os: [ ubuntu-latest ]
php: [ 8.3, 8.2, 8.1 ]
laravel: [ 11.*, 10.*, 9.* ]
php: [ 8.4, 8.3, 8.2, 8.1 ]
laravel: [ 12.*, 11.*, 10.*, 9.* ]
stability: [ prefer-lowest, prefer-stable ]
include:
- laravel: 12.*
testbench: 10.*
carbon: ^3.8.4
- laravel: 11.*
testbench: 9.*
carbon: ^2.63
@@ -30,6 +33,8 @@ jobs:
testbench: 7.*
carbon: ^2.63
exclude:
- laravel: 12.*
php: 8.1
- laravel: 11.*
php: 8.1

@@ -56,16 +61,25 @@ jobs:
with:
php-version: ${{ matrix.php }}
extensions: curl, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, pdo_mysql, iconv
coverage: none
coverage: ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.3' && matrix.laravel == '11.*' && matrix.stability == 'prefer-stable' && 'xdebug' || 'none' }}

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Execute tests
run: vendor/bin/phpunit
run: |
vendor/bin/phpunit ${{ startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.3' && matrix.laravel == '11.*' && matrix.stability == 'prefer-stable' && '--coverage-clover=clover.xml' || '' }}
env:
DB_USERNAME: user
DB_PASSWORD: secret
DB_PORT: ${{ job.services.mysql.ports[3306] }}

- name: Make code coverage badge
if: startsWith(github.event.head_commit.message, 'coverage') && matrix.php == '8.3' && matrix.laravel == '11.*' && matrix.stability == 'prefer-stable'
uses: timkrase/phpunit-coverage-badge@v1.2.1
with:
coverage_badge_path: .github/coverage.svg
push_badge: true
repo_token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -5,3 +5,4 @@ coverage
.phpunit.result.cache
.idea
.env
clover.xml
19 changes: 0 additions & 19 deletions .scrutinizer.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .styleci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

[![Latest Version on Packagist](https://img.shields.io/packagist/v/javaabu/generators.svg?style=flat-square)](https://packagist.org/packages/javaabu/generators)
[![Test Status](../../actions/workflows/run-tests.yml/badge.svg)](../../actions/workflows/run-tests.yml)
[![Quality Score](https://img.shields.io/scrutinizer/g/javaabu/generators.svg?style=flat-square)](https://scrutinizer-ci.com/g/javaabu/generators)
![Code Coverage Badge](./.github/coverage.svg)
[![Total Downloads](https://img.shields.io/packagist/dt/javaabu/generators.svg?style=flat-square)](https://packagist.org/packages/javaabu/generators)

Laravel generators on steroids
11 changes: 6 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -11,14 +11,15 @@
],
"require": {
"php": "^8.1",
"illuminate/support": "^9.0 || ^10.0 || ^11.0",
"illuminate/support": "^9.0 || ^10.0 || ^11.0 || ^12.0",
"symfony/process": "^6.0 || ^7.0",
"doctrine/dbal": "^3.6 || ^4.0"
"doctrine/dbal": "^3.6 || ^4.0",
"javaabu/generator-helpers": "^1.2"
},
"require-dev": {
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0",
"phpunit/phpunit": "^9.5 || ^10.5",
"javaabu/schema": "^1.0"
"orchestra/testbench": "^7.0 || ^8.0 || ^9.0 || ^10.0",
"phpunit/phpunit": "^9.5 || ^10.5 || ^11.5.3",
"javaabu/schema": "^1.1"
},
"autoload": {
"psr-4": {
1 change: 1 addition & 0 deletions docs/advanced-usage/customising-stubs.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Customising stubs
sidebar_position: 1
---

You can customise the stubs used by the generators by publishing them:
8 changes: 6 additions & 2 deletions docs/basic-usage/available-generators.md
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ php artisan generate:api_test products --create
# creates app/Http/Controllers/Api/ProductsController.php
# adds api routes to api.php routes file
# creates tests/Feature/Controllers/Api/ProductsControllerTest.php
php artisan generate:api products --create
php artisan generate:api products --create {--except=<commands to skip>}

# creates tests/Feature/Controllers/Admin/ProductsControllerTest.php
php artisan generate:test products --create
@@ -61,5 +61,9 @@ php artisan generate:test products --create
php artisan generate:views products --create

# creates all files specified above except API controller
php artisan generate:all products --create
# To skip a command, give comma separated list of commands
php artisan generate:all products --create {--except=<commands to skip>}

# To generate all except controllers and tests
php artisan generate:all products --create --except=controller,test
```
1 change: 1 addition & 0 deletions docs/limitations/supported-drivers.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
title: Supported drivers
sidebar_position: 1
---

Currently, the only supported database driver is `MySQL`
29 changes: 15 additions & 14 deletions docs/limitations/supported-field-types.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
title: Supported Field Types
sidebar_position: 2
---

This package works by mapping database schema column types to a custom `Field` class. The supported field types and their corresponding database column types are given below.

| Field Type | Column Types |
|-----------------|--------------------------------------------------------------------------------|
| BooleanField | `tinyint(1)` |
| DateField | `date` |
| DateTimeField | `datetime`, `timestamp` |
| DecimalField | `double`, `decimal`, `dec`, `float` |
| EnumField | `enum`, `set`, any column that has a comment in the format `enum:<EnumClass>` |
| ForeignKeyField | `Foreign` |
| IntegerField | `tinyint`, `smallint`, `mediumint`, `int`, `bigint` |
| JsonField | `json` |
| StringField | `varchar`, `char` |
| TextField | `text` |
| TimeField | `time` |
| YearField | `year` |
| Field Type | Column Types |
|-----------------|-------------------------------------------------------------------------------|
| BooleanField | `tinyint(1)` |
| DateField | `date` |
| DateTimeField | `datetime`, `timestamp` |
| DecimalField | `double`, `decimal`, `dec`, `float` |
| EnumField | `enum`, `set`, any column that has a comment in the format `enum:<EnumClass>` |
| ForeignKeyField | `Foreign` |
| IntegerField | `tinyint`, `smallint`, `mediumint`, `int`, `bigint` |
| JsonField | `json` |
| StringField | `varchar`, `char` |
| TextField | `text`, `tinytext`, `mediumtext`, `longtext` |
| TimeField | `time` |
| YearField | `year` |

Currently, morphs and pivots are not supported. Any unsupported column type will simply be skipped by the generators.
9 changes: 5 additions & 4 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -10,17 +10,18 @@
<directory>tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>src</directory>
</include>
</source>
<logging>
<junit outputFile="build/report.junit.xml"/>
<testdoxHtml outputFile="build/coverage"/>
<testdoxText outputFile="build/coverage.txt"/>
</logging>
<php>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_USERNAME" value="root"/>
<env name="DB_PASSWORD" value=""/>
<env name="DB_DATABASE" value="generators"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3307"/>
</php>
</phpunit>
2 changes: 1 addition & 1 deletion src/Commands/Auth/GenerateAuthFactoryCommand.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
namespace Javaabu\Generators\Commands\Auth;

use Javaabu\Generators\Generators\Auth\AuthFactoryGenerator;
use Javaabu\Generators\Support\StringCaser;
use Javaabu\GeneratorHelpers\StringCaser;

class GenerateAuthFactoryCommand extends BaseAuthGenerateCommand
{
8 changes: 4 additions & 4 deletions src/Commands/Auth/GenerateAuthModelCommand.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
namespace Javaabu\Generators\Commands\Auth;

use Javaabu\Generators\Generators\Auth\AuthModelGenerator;
use Javaabu\Generators\Support\StringCaser;
use Javaabu\GeneratorHelpers\StringCaser;

class GenerateAuthModelCommand extends BaseAuthGenerateCommand
{
@@ -62,18 +62,18 @@ protected function addSubjectTypeAndMorphMap(string $table): void
[
'search' => "Relation::enforceMorphMap([\n",
'keep_search' => true,
'content' => $this->renderer->addIndentation("'$morph_name' => \\App\\Models\\$class_name::class,\n", 3),
'content' => $this->getRenderer()->addIndentation("'$morph_name' => \\App\\Models\\$class_name::class,\n", 3),
],
[
'search' => "SubjectTypes::register([\n",
'keep_search' => true,
'content' => $this->renderer->addIndentation("\\App\\Models\\$class_name::class,\n", 3),
'content' => $this->getRenderer()->addIndentation("\\App\\Models\\$class_name::class,\n", 3),
],
[
'search' => "CauserTypes::register([\n",
'keep_search' => true,
'force' => true,
'content' => $this->renderer->addIndentation("\\App\\Models\\$class_name::class,\n", 3),
'content' => $this->getRenderer()->addIndentation("\\App\\Models\\$class_name::class,\n", 3),
],
];

2 changes: 1 addition & 1 deletion src/Commands/Auth/GenerateAuthPermissionsCommand.php
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ protected function createFiles(string $table, array $columns, string $auth_name,
{
$path = $this->getPath(database_path('seeders'), $path);

$stub = 'seeders/PermissionsSeeder.stub';
$stub = 'generators::seeders/PermissionsSeeder.stub';
$file_name = 'PermissionsSeeder.php';
$file_path = $this->getFullFilePath($path, $file_name);

2 changes: 1 addition & 1 deletion src/Commands/Auth/GenerateAuthPolicyCommand.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

use Javaabu\Generators\Generators\Auth\AuthPolicyGenerator;
use Javaabu\Generators\Generators\Auth\BaseAuthGenerator;
use Javaabu\Generators\Support\StringCaser;
use Javaabu\GeneratorHelpers\StringCaser;

class GenerateAuthPolicyCommand extends BaseAuthGenerateCommand
{
2 changes: 1 addition & 1 deletion src/Commands/Auth/GenerateAuthRequestCommand.php
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@

use Javaabu\Generators\Generators\Auth\AuthRequestGenerator;
use Javaabu\Generators\Generators\Auth\BaseAuthGenerator;
use Javaabu\Generators\Support\StringCaser;
use Javaabu\GeneratorHelpers\StringCaser;

class GenerateAuthRequestCommand extends BaseAuthGenerateCommand
{
2 changes: 1 addition & 1 deletion src/Commands/GenerateApiControllerCommand.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
namespace Javaabu\Generators\Commands;

use Javaabu\Generators\Generators\ApiControllerGenerator;
use Javaabu\Generators\Support\StringCaser;
use Javaabu\GeneratorHelpers\StringCaser;

class GenerateApiControllerCommand extends BaseGenerateCommand
{
2 changes: 1 addition & 1 deletion src/Commands/GenerateApiTestCommand.php
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
namespace Javaabu\Generators\Commands;

use Javaabu\Generators\Generators\ApiTestGenerator;
use Javaabu\Generators\Support\StringCaser;
use Javaabu\GeneratorHelpers\StringCaser;

class GenerateApiTestCommand extends BaseGenerateCommand
{
Loading