2017-08-27 04:44:53 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2018-04-15 02:05:41 +09:00
|
|
|
use App\MetadataResolver\MetadataResolver;
|
2020-06-02 22:20:26 +09:00
|
|
|
use GuzzleHttp\Client;
|
|
|
|
use GuzzleHttp\RequestOptions;
|
2018-12-13 23:49:26 +09:00
|
|
|
use Illuminate\Support\Facades\Blade;
|
2017-08-27 04:44:53 +09:00
|
|
|
use Illuminate\Support\ServiceProvider;
|
2018-12-13 23:49:26 +09:00
|
|
|
use Parsedown;
|
2017-08-27 04:44:53 +09:00
|
|
|
|
|
|
|
class AppServiceProvider extends ServiceProvider
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Bootstrap any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function boot()
|
|
|
|
{
|
2018-12-13 23:49:26 +09:00
|
|
|
Blade::directive('parsedown', function ($expression) {
|
|
|
|
return "<?php echo app('parsedown')->text($expression); ?>";
|
|
|
|
});
|
2020-02-04 01:43:58 +09:00
|
|
|
|
|
|
|
stream_filter_register('convert.mbstring.*', 'Stream_Filter_Mbstring');
|
2017-08-27 04:44:53 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register any application services.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function register()
|
|
|
|
{
|
2018-04-15 02:05:41 +09:00
|
|
|
$this->app->singleton(MetadataResolver::class, function ($app) {
|
|
|
|
return new MetadataResolver();
|
|
|
|
});
|
2018-12-13 23:49:26 +09:00
|
|
|
$this->app->singleton('parsedown', function () {
|
|
|
|
return Parsedown::instance();
|
|
|
|
});
|
2020-06-02 22:20:26 +09:00
|
|
|
$this->app->bind(Client::class, function () {
|
|
|
|
return new Client([
|
|
|
|
RequestOptions::HEADERS => [
|
|
|
|
'User-Agent' => 'TissueBot/1.0'
|
|
|
|
]
|
|
|
|
]);
|
|
|
|
});
|
2017-08-27 04:44:53 +09:00
|
|
|
}
|
|
|
|
}
|