-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathBlogdownProvider.php
43 lines (34 loc) · 1.15 KB
/
BlogdownProvider.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Swiftmade\Blogdown;
use Illuminate\Support\Facades\Config;
use Swiftmade\Blogdown\Commands\NewPost;
use Swiftmade\Blogdown\Commands\IndexPosts;
use Illuminate\Support\ServiceProvider as LaravelServiceProvider;
class BlogdownProvider extends LaravelServiceProvider
{
public function register()
{
$this->publishes([
__DIR__ . '/config/blogdown.php' => config_path('blogdown.php'),
__DIR__ . '/resources/views' => resource_path('views/vendor/blogdown'),
]);
$this->loadViewsFrom(__DIR__ . '/resources/views', 'blogdown');
$this->mergeConfigFrom(
__DIR__ . '/config/blogdown.php',
'blogdown'
);
if (Config::get('blogdown.register_routes')) {
$this->loadRoutesFrom(__DIR__ . '/Http/routes.php');
}
$this->commands([
IndexPosts::class,
NewPost::class,
]);
$this->app->singleton('blogdown.postModel', function () {
return function ($data) {
$class = Config::get('blogdown.post_model');
return new $class($data);
};
});
}
}