2017-08-27 04:44:53 +09:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Providers;
|
|
|
|
|
2018-04-15 02:05:41 +09:00
|
|
|
use App\MetadataResolver\MetadataResolver;
|
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); ?>";
|
|
|
|
});
|
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();
|
|
|
|
});
|
2017-08-27 04:44:53 +09:00
|
|
|
}
|
|
|
|
}
|