-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathKernel.php
More file actions
30 lines (23 loc) · 781 Bytes
/
Kernel.php
File metadata and controls
30 lines (23 loc) · 781 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
namespace App\Http\Middleware;
use Closure;
class ReplaceOldS3Urls
{
public function handle($request, Closure $next)
{
$response = $next($request);
if ($response instanceof \Illuminate\Http\Response && str_contains($response->headers->get('Content-Type'), 'text/html')) {
$content = $response->getContent();
$content = str_replace(
'https://s3-eu-west-1.amazonaws.com/codeweek-s3/',
'https://codeweek-s3.s3.eu-west-1.amazonaws.com/',
$content
);
$response->setContent($content);
}
return $response;
}
}