попытка унифицировать работу с api через использование класса, формирующего ответ на api запрос. В парадигме ларавель подразумевается использовать Resource, но как по мне, его функционал несколько уже, чем хотелось бы. Достаточно сырая реализация, можно лучше
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use App\Services\ApiResponder;
|
||||
|
||||
class ApiResponderProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Register services.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
$this->app->bind(ApiResponder::class, function($app){
|
||||
return new ApiResponder();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Bootstrap services.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user