PHP code example of uncover / modular-monolith-laravel
1. Go to this page and download the library: Download uncover/modular-monolith-laravel library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
uncover / modular-monolith-laravel example snippets
use App\Http\Controllers\EmailVerificationController;
// Basic usage
Route::moduleResource('email-verifications', EmailVerificationController::class);
// With middleware
Route::moduleResource('email-verifications', EmailVerificationController::class, [
'middleware' => ['auth:sanctum', 'EmailVerificationMiddleware']
]);
class EmailVerificationObserver extends ModularObserver
{
public static function getObservedModel(): string
{
return EmailVerification::class;
}
public function created(EmailVerification $model): void
{
// Handle after creation
}
}
// AppServiceProvider.php
public function boot()
{
EmailVerificationObserver::register();
}