Skip to content

Commit

Permalink
Add: event service provider
Browse files Browse the repository at this point in the history
  • Loading branch information
baselrabia committed Sep 22, 2022
1 parent 3641294 commit 0215ed2
Show file tree
Hide file tree
Showing 5 changed files with 176 additions and 10 deletions.
6 changes: 6 additions & 0 deletions app/Http/Controllers/HomeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@ class HomeController

public function index(){

$user = User::create([
"name" => "new user",
"email" => "[email protected]",
]);

return new Response([
"data" => $user,
"msg" => "hello there from home controller",
"status" => "success request",
]);
Expand Down
40 changes: 40 additions & 0 deletions app/Providers/EventServiceProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace App\Providers;

use Illuminate\Foundation\Support\Providers\EventServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Event;

class EventServiceProvider extends ServiceProvider
{
/**
* The event to listener mappings for the application.
*
* @var array<class-string, array<int, class-string>>
*/
protected $listen = [
// Registered::class => [
// SendEmailVerificationNotification::class,
// ],
];

/**
* Register any events for your application.
*
* @return void
*/
public function boot()
{
//
}

/**
* Determine if events and listeners should be automatically discovered.
*
* @return bool
*/
public function shouldDiscoverEvents()
{
return false;
}
}
2 changes: 1 addition & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function boot()

// $this->configureRateLimiting();
$this->routes(function () {
Route::prefix('api')
Route::prefix('')
->group(base_path('routes/api.php'));
});
}
Expand Down
113 changes: 107 additions & 6 deletions bootstrap/cache/services.php
Original file line number Diff line number Diff line change
@@ -1,17 +1,118 @@
<?php return array (
'providers' =>
array (
0 => 'Carbon\\Laravel\\ServiceProvider',
1 => 'App\\Providers\\AppServiceProvider',
2 => 'App\\Providers\\RouteServiceProvider',
0 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
1 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
3 => 'Illuminate\\Cache\\CacheServiceProvider',
4 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
5 => 'Carbon\\Laravel\\ServiceProvider',
6 => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
7 => 'App\\Providers\\AppServiceProvider',
8 => 'App\\Providers\\EventServiceProvider',
9 => 'App\\Providers\\RouteServiceProvider',
),
'eager' =>
array (
0 => 'Carbon\\Laravel\\ServiceProvider',
1 => 'App\\Providers\\AppServiceProvider',
2 => 'App\\Providers\\RouteServiceProvider',
0 => 'Illuminate\\Foundation\\Providers\\FoundationServiceProvider',
1 => 'Illuminate\\Filesystem\\FilesystemServiceProvider',
2 => 'Illuminate\\Database\\DatabaseServiceProvider',
3 => 'Illuminate\\Encryption\\EncryptionServiceProvider',
4 => 'Carbon\\Laravel\\ServiceProvider',
5 => 'App\\Providers\\AppServiceProvider',
6 => 'App\\Providers\\EventServiceProvider',
7 => 'App\\Providers\\RouteServiceProvider',
),
'deferred' =>
array (
'cache' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.store' => 'Illuminate\\Cache\\CacheServiceProvider',
'cache.psr6' => 'Illuminate\\Cache\\CacheServiceProvider',
'memcached.connector' => 'Illuminate\\Cache\\CacheServiceProvider',
'Illuminate\\Cache\\RateLimiter' => 'Illuminate\\Cache\\CacheServiceProvider',
'Illuminate\\Foundation\\Console\\AboutCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\ClearCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\ForgetCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ClearCompiledCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConfigCacheCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConfigClearCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\DbCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\MonitorCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\PruneCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\ShowCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\TableCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\WipeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\DownCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EnvironmentCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventCacheCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventClearCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventListCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\KeyGenerateCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\OptimizeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\OptimizeClearCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\PackageDiscoverCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RouteCacheCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RouteClearCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RouteListCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\DumpCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Seeds\\SeedCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleFinishCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleListCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleRunCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleClearCacheCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleTestCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Console\\Scheduling\\ScheduleWorkCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ShowModelCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\UpCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Cache\\Console\\CacheTableCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\CastMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ChannelMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ComponentMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ConsoleMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Routing\\Console\\ControllerMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\DocsCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventGenerateCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\EventMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ExceptionMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Factories\\FactoryMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\JobMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ListenerMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\MailMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Routing\\Console\\MiddlewareMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ModelMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\NotificationMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ObserverMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\PolicyMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ProviderMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RequestMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ResourceMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\RuleMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ScopeMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Seeds\\SeederMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\ServeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\StubPublishCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\TestMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Foundation\\Console\\VendorPublishCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'migrator' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'migration.repository' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'migration.creator' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\MigrateCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\FreshCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\InstallCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\RefreshCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\ResetCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\RollbackCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\StatusCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'Illuminate\\Database\\Console\\Migrations\\MigrateMakeCommand' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
'composer' => 'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider',
),
'when' =>
array (
'Illuminate\\Cache\\CacheServiceProvider' =>
array (
),
'Run\\Steps\\Console\\Providers\\ConsoleSupportServiceProvider' =>
array (
),
),
);
25 changes: 22 additions & 3 deletions public/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
use Illuminate\Foundation\Http\Kernel;
use Illuminate\Http\Request;

define('RUN_START', microtime(true));

/*
|--------------------------------------------------------------------------
| Create The Application
Expand All @@ -27,13 +29,30 @@
|
*/

/*
|--------------------------------------------------------------------------
| Create Http Kernel
|--------------------------------------------------------------------------
*/

$kernel = $app->make(Kernel::class);

/*
|--------------------------------------------------------------------------
| Handel the Request Then Send the Response
|--------------------------------------------------------------------------
*/

$request = Request::capture();

$response = $kernel->handle($request);

$response = $kernel->handle(
$request = Request::capture()
)->send();
$response->send();

/*
|--------------------------------------------------------------------------
| Shutdown the Http Kernel
|--------------------------------------------------------------------------
*/

$kernel->terminate($request, $response);

0 comments on commit 0215ed2

Please sign in to comment.