why use dependency injection laravel code example
Example 1: laravel dependency injection
<?php
class Service
{
//
}r
Route::get('/', function (Service $service) {
die(get_class($service));
});
Example 2: laravel dependency injection
<?php
class Service
{
//
}
Route::get('/', function (Service $service) {
die(get_class($service));
});