mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
37 lines
770 B
PHP
37 lines
770 B
PHP
<?php
|
|
|
|
namespace App\Providers;
|
|
|
|
use Response;
|
|
use Illuminate\Support\ServiceProvider;
|
|
|
|
class ResponseMacroServiceProvider extends ServiceProvider
|
|
{
|
|
/**
|
|
* Perform post-registration booting of services.
|
|
*
|
|
* @param ResponseFactory $factory
|
|
* @return void
|
|
*/
|
|
public function boot()
|
|
{
|
|
Response::macro('png', function ($src = "", $status = 200, $header = []) {
|
|
return Response::stream(function() use ($src, $status) {
|
|
echo $src;
|
|
}, $status, array_merge([
|
|
'Content-type' => 'image/png',
|
|
], $header));
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Register any application services.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function register()
|
|
{
|
|
//
|
|
}
|
|
}
|