Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 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.2.5",
"illuminate/console": "^6.0|^7.0|^8.0",
"illuminate/database": "^6.0|^7.0|^8.0",
"illuminate/support": "^6.0|^7.0|^8.0",
"illuminate/routing": "^6.0|^7.0|^8.0"
"php": "^7.4|^8.0",
"illuminate/console": "^8.0",
"illuminate/database": "^8.0",
"illuminate/support": "^8.0",
"illuminate/routing": "^8.0"
},
"require-dev": {
"phpunit/phpunit" : "^8.0",
"mockery/mockery": "^1.0",
"orchestra/testbench": "^4.0"
"phpunit/phpunit": "^9.5",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^6.0"
},
"autoload": {
"psr-4": {
Expand Down
40 changes: 11 additions & 29 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace Zonneplan\ModuleLoader;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Database\Eloquent\Factory;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\Gate;
Expand All @@ -22,29 +21,24 @@
abstract class Module extends ServiceProvider implements ModuleContract
{
protected const ROUTE_FILE_TYPES = [
'routes', 'web', 'api',
'routes',
'web',
'api',
];

/** @var array */
protected $policies = [];
protected array $policies = [];

/** @var array */
protected $middleware = [];
protected array $middleware = [];

/** @var array */
protected $listen = [];
protected array $listen = [];

/** @var array */
protected $subscribe = [];
protected array $subscribe = [];

/** @var string */
protected $modulePath;
protected string $modulePath;

/**
* Register the module.
*
* @throws ReflectionException
*
* @return void
*/
public function register(): void
Expand All @@ -56,9 +50,8 @@ public function register(): void
/**
* Boot the module.
*
* @throws ReflectionException
*
* @return void
* @throws ReflectionException
*/
public function boot(): void
{
Expand Down Expand Up @@ -91,8 +84,6 @@ protected function loadCommandSchedule(): void
}

/**
* @throws ReflectionException
*
* @return void
*/
protected function loadMigrations(): void
Expand All @@ -105,8 +96,6 @@ protected function loadMigrations(): void
}

/**
* @throws ReflectionException
*
* @return void
*/
protected function loadViews(): void
Expand All @@ -119,8 +108,6 @@ protected function loadViews(): void
}

/**
* @throws ReflectionException
*
* @return void
*/
protected function loadTranslations(): void
Expand All @@ -133,8 +120,6 @@ protected function loadTranslations(): void
}

/**
* @throws ReflectionException
*
* @return void
*/
protected function loadConfigs(): void
Expand Down Expand Up @@ -180,8 +165,6 @@ protected function registerListeners(): void
}

/**
* @throws ReflectionException
*
* @return string
*/
protected function getModulePath(): string
Expand Down Expand Up @@ -246,9 +229,8 @@ private function registerMiddleware(): void
*/
private function registerFactories(): void
{
$this->app->afterResolving(Factory::class, function (Factory $faker) {
$faker->load($this->getModulePath().'/Database/Factories');
});
// Unfortunately Laravel 8 no longer supports loading factories like this
// because they want you to use ModelFactories.
}

private function registerRoutes(): void
Expand Down
3 changes: 1 addition & 2 deletions src/Support/ModuleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
*/
class ModuleRepository implements ModuleRepositoryContract
{
/** @var array */
protected $modules = [];
protected array $modules = [];

/**
* Registers a new module with a path.
Expand Down