Skip to content
This repository was archived by the owner on Jan 15, 2024. It is now read-only.

Commit b97e15e

Browse files
committed
update readme and clean code
1 parent 2f87e09 commit b97e15e

File tree

5 files changed

+52
-30
lines changed

5 files changed

+52
-30
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,26 @@
1-
# laravel-generator
1+
# Welcome to Laravel Generator by TanHongIT
2+
3+
This package is used to generate models, controllers, views, routes, migrations, seeders, factories, requests, and more for Laravel.
4+
5+
## Technology
6+
7+
- PHP ^8.0
8+
- Laravel Framework 8.x, 9.x, 10.x
9+
- Composer
10+
11+
## Installation
12+
13+
```bash
14+
composer require tanhongit/laravel-generator
15+
```
16+
17+
## License
18+
19+
The MIT License (MIT). Please see [License File](LICENSE) for more information.
20+
21+
<p align="center">
22+
<a href="https://packagist.org/packages/tanhongit/laravel-generator">
23+
<img src="https://img.shields.io/packagist/l/doctrine/orm.svg" data-origin="https://img.shields.io/packagist/l/doctrine/orm.svg" alt="license">
24+
</a>
25+
</p>
26+

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"minimum-stability": "dev",
3030
"prefer-stable": true,
3131
"require": {
32-
"php": ">=7.3"
32+
"php": "^8.0"
3333
},
3434
"support": {
3535
"issues": "https://github.com/tanhongit/laravel-generator/issues"

src/Http/Controllers/Detect/DetectPatternController.php

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,6 @@
1010

1111
class DetectPatternController extends Controller
1212
{
13-
/**
14-
* Get the total number of repositories in the application.
15-
*
16-
* @return int|null
17-
*/
18-
public function detectRepositoryPattern()
19-
{
20-
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(app_path()));
21-
22-
$repositories = [];
23-
24-
foreach ($files as $file) {
25-
if ($file->isFile() && $file->getExtension() === 'php') {
26-
$class = $this->getClassFromFile($file);
27-
if ($class !== null && $this->isRepositoryClass($class)) {
28-
$repositories[] = $class->getName();
29-
}
30-
}
31-
}
32-
33-
return count($repositories);
34-
}
35-
3613
/**
3714
* @param $file
3815
*
@@ -151,5 +128,27 @@ public function isRepositoryClass(ReflectionClass $class)
151128
&& $this->dependsOnModels($class);
152129
}
153130

131+
/**
132+
* Get the total number of repositories in the application.
133+
*
134+
* @return int|null
135+
*/
136+
public function detectRepositoryPattern()
137+
{
138+
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(app_path()));
139+
140+
$repositories = [];
141+
142+
foreach ($files as $file) {
143+
if ($file->isFile() && $file->getExtension() === 'php') {
144+
$class = $this->getClassFromFile($file);
145+
if ($class !== null && $this->isRepositoryClass($class)) {
146+
$repositories[] = $class->getName();
147+
}
148+
}
149+
}
150+
151+
return count($repositories);
152+
}
154153
}
155154

src/Http/Controllers/LaravelGeneratorController.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
use Illuminate\Contracts\Foundation\Application;
88
use Illuminate\Contracts\View\Factory;
99
use Illuminate\Contracts\View\View;
10-
use RecursiveDirectoryIterator;
11-
use RecursiveIteratorIterator;
1210
use TanHongIT\LaravelGenerator\Http\Controllers\Detect\DetectPatternController;
1311

14-
1512
class LaravelGeneratorController extends Controller
1613
{
1714
/**

src/Providers/LaravelGenerateServiceProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ public function boot(): void
3434
*
3535
* @return void
3636
*/
37-
public function register()
37+
public function register(): void
3838
{
39-
//
39+
$configPath = __DIR__ . '/../../config/laravel-generator.php';
40+
$this->mergeConfigFrom($configPath, 'laravel-generator');
4041
}
4142
}

0 commit comments

Comments
 (0)