Skip to content

Commit 4f40547

Browse files
authored
Merge pull request #7 from zonneplan/feature/support-laravel-9
Support Laravel 9
2 parents f3533e7 + f2fb41d commit 4f40547

6 files changed

+22
-12
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ composer.lock
66
phpunit.xml
77
.env
88
.idea
9-
.phpunit.result.cache
9+
.phpunit.result.cache
10+
.DS_Store

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@
55
[![Build Status](https://img.shields.io/travis/zonneplan/laravel-module-loader/master.svg?style=flat-square)](https://travis-ci.org/zonneplan/laravel-module-loader)
66
[![Total Downloads](https://img.shields.io/packagist/dt/zonneplan/laravel-module-loader.svg?style=flat-square)](https://packagist.org/packages/zonneplan/laravel-module-loader)
77

8+
| **Laravel** | **laravel-module-loader** |
9+
|---|---------------------------|
10+
| 5.8 | ^1.0 |
11+
| 6.0 | ^1.0 |
12+
| 7.0 | ^1.0 |
13+
| 8.0 | ^2.0 |
14+
| 9.0 | ^3.0 |
15+
816
The `zonneplan/laravel-module-loader` package provides an easy to use module loader
917
which can be used to modulize your project.
1018

composer.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
"license": "MIT",
1313
"authors": [],
1414
"require": {
15-
"php": "^7.4|^8.0",
16-
"illuminate/console": "^8.0",
17-
"illuminate/database": "^8.0",
18-
"illuminate/support": "^8.0",
19-
"illuminate/routing": "^8.0"
15+
"php": "^8.0",
16+
"illuminate/console": "^9.0",
17+
"illuminate/database": "^9.0",
18+
"illuminate/support": "^9.0",
19+
"illuminate/routing": "^9.0"
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "^9.5",
2323
"mockery/mockery": "^1.4",
24-
"orchestra/testbench": "^6.0"
24+
"orchestra/testbench": "^7.0"
2525
},
2626
"autoload": {
2727
"psr-4": {

src/Module.php

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ abstract class Module extends ServiceProvider implements ModuleContract
3636

3737
protected ?string $modulePath = null;
3838

39+
protected bool $enableLegacyFactoryLoading = false;
40+
3941
/**
4042
* Register the module.
4143
*
@@ -230,6 +232,7 @@ private function registerMiddleware(): void
230232
private function registerFactories(): void
231233
{
232234
if (
235+
$this->enableLegacyFactoryLoading &&
233236
method_exists($this, 'loadFactoriesFrom') &&
234237
file_exists($this->getModulePath().'/Database/Factories')
235238
) {

src/ModulesServiceProvider.php

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@ class ModulesServiceProvider extends ServiceProvider
1717
*/
1818
public function register(): void
1919
{
20-
$this->app->singleton(ModuleRepositoryContract::class, static function () {
21-
return new ModuleRepository();
22-
});
20+
$this->app->singleton(ModuleRepositoryContract::class, ModuleRepository::class);
2321
}
2422

2523
/**

tests/Support/ModuleRepositoryTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44

55
use Zonneplan\ModuleLoader\Support\Contracts\ModuleRepositoryContract;
66
use Zonneplan\ModuleLoader\Support\Exceptions\ModuleNotFoundException;
7+
use Zonneplan\ModuleLoader\Support\ModuleRepository;
78
use Zonneplan\ModuleLoader\Test\TestCase;
89

910
class ModuleRepositoryTest extends TestCase
1011
{
11-
/* @var ModuleRepository */
12-
protected $moduleRepository;
12+
protected ModuleRepository $moduleRepository;
1313

1414
public function setUp(): void
1515
{

0 commit comments

Comments
 (0)