Skip to content

Commit

Permalink
Merge pull request #7 from zonneplan/feature/support-laravel-9
Browse files Browse the repository at this point in the history
Support Laravel 9
  • Loading branch information
rdgout authored Feb 24, 2022
2 parents f3533e7 + f2fb41d commit 4f40547
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ composer.lock
phpunit.xml
.env
.idea
.phpunit.result.cache
.phpunit.result.cache
.DS_Store
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
[![Build Status](https://img.shields.io/travis/zonneplan/laravel-module-loader/master.svg?style=flat-square)](https://travis-ci.org/zonneplan/laravel-module-loader)
[![Total Downloads](https://img.shields.io/packagist/dt/zonneplan/laravel-module-loader.svg?style=flat-square)](https://packagist.org/packages/zonneplan/laravel-module-loader)

| **Laravel** | **laravel-module-loader** |
|---|---------------------------|
| 5.8 | ^1.0 |
| 6.0 | ^1.0 |
| 7.0 | ^1.0 |
| 8.0 | ^2.0 |
| 9.0 | ^3.0 |

The `zonneplan/laravel-module-loader` package provides an easy to use module loader
which can be used to modulize your project.

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
"license": "MIT",
"authors": [],
"require": {
"php": "^7.4|^8.0",
"illuminate/console": "^8.0",
"illuminate/database": "^8.0",
"illuminate/support": "^8.0",
"illuminate/routing": "^8.0"
"php": "^8.0",
"illuminate/console": "^9.0",
"illuminate/database": "^9.0",
"illuminate/support": "^9.0",
"illuminate/routing": "^9.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^6.0"
"orchestra/testbench": "^7.0"
},
"autoload": {
"psr-4": {
Expand Down
3 changes: 3 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ abstract class Module extends ServiceProvider implements ModuleContract

protected ?string $modulePath = null;

protected bool $enableLegacyFactoryLoading = false;

/**
* Register the module.
*
Expand Down Expand Up @@ -230,6 +232,7 @@ private function registerMiddleware(): void
private function registerFactories(): void
{
if (
$this->enableLegacyFactoryLoading &&
method_exists($this, 'loadFactoriesFrom') &&
file_exists($this->getModulePath().'/Database/Factories')
) {
Expand Down
4 changes: 1 addition & 3 deletions src/ModulesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class ModulesServiceProvider extends ServiceProvider
*/
public function register(): void
{
$this->app->singleton(ModuleRepositoryContract::class, static function () {
return new ModuleRepository();
});
$this->app->singleton(ModuleRepositoryContract::class, ModuleRepository::class);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions tests/Support/ModuleRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use Zonneplan\ModuleLoader\Support\Contracts\ModuleRepositoryContract;
use Zonneplan\ModuleLoader\Support\Exceptions\ModuleNotFoundException;
use Zonneplan\ModuleLoader\Support\ModuleRepository;
use Zonneplan\ModuleLoader\Test\TestCase;

class ModuleRepositoryTest extends TestCase
{
/* @var ModuleRepository */
protected $moduleRepository;
protected ModuleRepository $moduleRepository;

public function setUp(): void
{
Expand Down

0 comments on commit 4f40547

Please sign in to comment.