Skeleton is ready
This commit is contained in:
60
app/Feature/Example/Provider.php
Normal file
60
app/Feature/Example/Provider.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Feature\Example;
|
||||
|
||||
use App\Feature\Example\Command\DoSomething;
|
||||
use App\Feature\Example\Http\Controller\User;
|
||||
use App\Feature\Example\Listener\DoSomethingOnEvent;
|
||||
use App\Kernel\Feature\HasCommandsList;
|
||||
use App\Kernel\Feature\HasEventListeners;
|
||||
use App\Shared\Event\User\Created as UserCreated;
|
||||
use Illuminate\Routing\Route;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class Provider extends ServiceProvider
|
||||
{
|
||||
use HasCommandsList, HasEventListeners;
|
||||
|
||||
/**
|
||||
* @var array<string,class-string>
|
||||
*/
|
||||
public array $bindings = [
|
||||
/** Bindings section */
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array<int,class-string>
|
||||
*/
|
||||
private array $commandsList = [
|
||||
DoSomething::class,
|
||||
];
|
||||
|
||||
private array $eventListeners = [
|
||||
UserCreated::class => [
|
||||
DoSomethingOnEvent::class,
|
||||
],
|
||||
];
|
||||
|
||||
public function register(): void
|
||||
{
|
||||
/** Register something here */
|
||||
}
|
||||
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerListeners();
|
||||
$this->registerRoutes();
|
||||
}
|
||||
|
||||
private function registerRoutes(): void
|
||||
{
|
||||
Route::middleware('auth:sanctum')
|
||||
->controller(User::class)
|
||||
->group(function (): void {
|
||||
Route::get('/users', 'index')->name('users.index');
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user