for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Bhavingajjar\LaravelApiGenerator\Middleware;
use Closure;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Config;
class ApiHeaderInject
{
public function handle($request, Closure $next)
if(config('laravel-api-generator.json_response')) {
$request->headers->add([
'Accept'=>'application/json',
'Content-Type'=>'application/json'
]);
}
if(config('laravel-api-generator.allow_cross_origin')) {
'Access-Control-Allow-Origin' => '*',
'Access-Control-Allow-Methods' => 'GET, POST, PUT, DELETE, OPTIONS'
return $next($request);