2017-10-09 17:45:31 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
|
|
|
|
class AddXHeader
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Handle an incoming request.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
* @param \Closure $next
|
|
|
|
* @return mixed
|
|
|
|
*/
|
|
|
|
public function handle($request, Closure $next)
|
|
|
|
{
|
|
|
|
$response = $next($request);
|
|
|
|
|
2017-10-13 15:34:39 +03:00
|
|
|
// Check if we should add header
|
|
|
|
if (method_exists($response, 'header')) {
|
|
|
|
$response->header('X-Akaunting', 'Free Accounting Software');
|
|
|
|
}
|
2017-10-09 17:45:31 +03:00
|
|
|
|
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
}
|