FEATURE: add basic article list
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
<?php namespace Modules\Blog\ArticleList\Providers;
|
||||
|
||||
use App\Handlers\Registrators\TemplateRegistrator;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use InvalidArgumentException;
|
||||
use Modules\Blog\ArticleList\Handlers\ArticleList;
|
||||
|
||||
class ArticleListServiceProvider extends ServiceProvider {
|
||||
|
||||
@@ -30,7 +33,6 @@ class ArticleListServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,12 +42,8 @@ class ArticleListServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
__DIR__.'/../Config/config.php' => config_path('articlelist.php'),
|
||||
]);
|
||||
$this->mergeConfigFrom(
|
||||
__DIR__.'/../Config/config.php', 'articlelist'
|
||||
);
|
||||
$this->publishes([__DIR__.'/../Config/config.php' => config_path('articlelist.php')]);
|
||||
$this->mergeConfigFrom(__DIR__.'/../Config/config.php', 'articlelist');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,16 +54,30 @@ class ArticleListServiceProvider extends ServiceProvider {
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = base_path('resources/views/modules/articlelist');
|
||||
|
||||
$sourcePath = __DIR__.'/../Resources/views';
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
]);
|
||||
$this->publishes([$sourcePath => $viewPath]);
|
||||
|
||||
$this->loadViewsFrom(array_merge(array_map(function ($path) {
|
||||
return $path . '/modules/articlelist';
|
||||
}, \Config::get('view.paths')), [$sourcePath]), 'articlelist');
|
||||
|
||||
|
||||
/**
|
||||
* @var $registrator TemplateRegistrator
|
||||
*/
|
||||
try {
|
||||
// setup some global variables
|
||||
$registrator = $this->app->make('registerTemplateDir');
|
||||
$registrator->setBaseDirectory('resources/views/modules/articlelist/visitor');
|
||||
$registrator->setNamespace('articlelist');
|
||||
$registrator->setModuleId(ArticleList::getModuleId());
|
||||
|
||||
// register path with current template name
|
||||
$registrator->register(config('app.theme'), 'articlelist::module.templatePath');
|
||||
} catch (InvalidArgumentException $e) {
|
||||
// ignore this exception
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user