Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
duyphan2502 committed Nov 28, 2016
1 parent 5b02bec commit 9cd6604
Show file tree
Hide file tree
Showing 36 changed files with 41 additions and 1,158 deletions.
8 changes: 4 additions & 4 deletions app/Http/Controllers/Resolvers/PageController.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
use App\Http\Controllers\AbstractController;
use WebEd\Plugins\Blog\Repositories\Contracts\PostRepositoryContract;
use WebEd\Plugins\Blog\Repositories\PostRepository;
use WebEd\Plugins\Pages\Models\Contracts\PageModelContract;
use WebEd\Plugins\Pages\Models\EloquentPage;
use WebEd\Plugins\Pages\Repositories\Contracts\PageContract;
use WebEd\Plugins\Pages\Repositories\PageRepository;
use WebEd\Base\Pages\Models\Contracts\PageModelContract;
use WebEd\Base\Pages\Models\EloquentPage;
use WebEd\Base\Pages\Repositories\Contracts\PageContract;
use WebEd\Base\Pages\Repositories\PageRepository;

class PageController extends AbstractController
{
Expand Down
4 changes: 2 additions & 2 deletions app/Http/Controllers/SlugWithoutSuffixController.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php namespace App\Http\Controllers;

use Illuminate\Routing\Controller;
use WebEd\Plugins\Pages\Repositories\Contracts\PageContract;
use WebEd\Plugins\Pages\Repositories\PageRepository;
use WebEd\Base\Pages\Repositories\Contracts\PageContract;
use WebEd\Base\Pages\Repositories\PageRepository;

class SlugWithoutSuffixController extends Controller
{
Expand Down
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@
"database"
],
"psr-4": {
"App\\": "app/"
"App\\": "app/",
"WebEd\\Base\\Pages\\": "sgsoft-studio/pages/src",
"WebEd\\Plugins\\CustomFields\\": "plugins/custom-fields/src"
}
},
"autoload-dev": {
Expand All @@ -65,4 +67,4 @@
"config": {
"preferred-install": "dist"
}
}
}
2 changes: 1 addition & 1 deletion database/seeds/PagesDatabaseSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function run()
'About Us',
];
foreach ($pages as $key => $row) {
\WebEd\Plugins\Pages\Models\EloquentPage::create([
\WebEd\Base\Pages\Models\EloquentPage::create([
'title' => $row,
'page_template' => $row,
'status' => 'activated',
Expand Down
8 changes: 4 additions & 4 deletions documentation/console/module.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ php artisan cms:install --refresh

####Get all modules information
```
php artisan cms:get:modules
php artisan cms:get:modules --type=base
php artisan cms:get:modules --type=plugins
php artisan module:list
php artisan module:list --type=base
php artisan module:list --type=plugins
```

####Export a base module
When you need to modify a base core module. It's time to use export method.
To know the alias of module, just run:
```
php artisan cms:get:modules --type=base
php artisan module:list --type=base
```
Then run
```
Expand Down
3 changes: 1 addition & 2 deletions plugins/blog/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"description": "Blog management package.",
"namespace": "WebEd\\Plugins\\Blog",
"version": "2.0",
"autoload": "psr-4",
"enabled": false
"autoload": "psr-4"
}
10 changes: 1 addition & 9 deletions plugins/blog/src/Providers/ModuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,10 @@ public function boot()
public function register()
{
//Load helpers
$this->loadHelpers();
load_module_helpers(__DIR__);

$this->app->register(RouteServiceProvider::class);
$this->app->register(RepositoryServiceProvider::class);
$this->app->register(BootstrapModuleServiceProvider::class);
}

protected function loadHelpers()
{
$helpers = $this->app['files']->glob(__DIR__ . '/../../helpers/*.php');
foreach ($helpers as $helper) {
require_once $helper;
}
}
}
2 changes: 1 addition & 1 deletion plugins/blog/src/Repositories/CategoryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class CategoryRepository extends AbstractBaseRepository implements CategoryRepos
'parent_id' => 'integer|min:0|nullable',
'page_template' => 'string|max:255|nullable',
'title' => 'string|max:255|required',
'slug' => 'string|max:255|alpha_dash|unique:posts',
'slug' => 'string|max:255|alpha_dash|unique:categories',
'description' => 'string|max:1000',
'content' => 'string',
'thumbnail' => 'string|max:255',
Expand Down
3 changes: 1 addition & 2 deletions plugins/custom-fields/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
"description": "Custom fields management package",
"namespace": "WebEd\\Plugins\\CustomFields",
"version": "2.0",
"autoload": "psr-4",
"enabled": false
"autoload": "psr-4"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace WebEd\Plugins\CustomFields\Hook\Actions\Render;

use WebEd\Base\Core\Models\Contracts\BaseModelContract;
use WebEd\Plugins\Pages\Http\Controllers\PageController;
use WebEd\Base\Pages\Http\Controllers\PageController;

class Categories extends AbstractRenderer
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/custom-fields/src/Hook/Actions/Render/Pages.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace WebEd\Plugins\CustomFields\Hook\Actions\Render;

use WebEd\Base\Core\Models\Contracts\BaseModelContract;
use WebEd\Plugins\Pages\Http\Controllers\PageController;
use WebEd\Base\Pages\Http\Controllers\PageController;

class Pages extends AbstractRenderer
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/custom-fields/src/Hook/Actions/Store/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ class Pages extends AbstractStore
/**
* @var string
*/
protected $repositoryInterface = 'WebEd\Plugins\Pages\Repositories\Contracts\PageContract';
protected $repositoryInterface = 'WebEd\Base\Pages\Repositories\Contracts\PageContract';
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,10 @@ private function registerUsersFields()

private function registerPagesFields()
{
if (interface_exists('\WebEd\Plugins\Pages\Repositories\Contracts\PageContract')) {
if (interface_exists('\WebEd\Base\Pages\Repositories\Contracts\PageContract')) {
\CustomFieldRules::registerRule('Basic', 'Page template', 'page_template', get_templates('Page'))
->registerRule('Basic', 'Page', 'page', function () {
$pageRepository = $this->app->make(\WebEd\Plugins\Pages\Repositories\Contracts\PageContract::class);
$pageRepository = $this->app->make(\WebEd\Base\Pages\Repositories\Contracts\PageContract::class);
$pages = $pageRepository->all([
'order' => 'ASC',
'title' => 'ASC',
Expand All @@ -122,7 +122,8 @@ private function registerPagesFields()

private function registerBlogFields()
{
if (interface_exists('\WebEd\Plugins\Blog\Repositories\Contracts\PostRepositoryContract') &&
if (
interface_exists('\WebEd\Plugins\Blog\Repositories\Contracts\PostRepositoryContract') &&
interface_exists('\WebEd\Plugins\Blog\Repositories\Contracts\CategoryRepositoryContract')
) {
/**
Expand Down
20 changes: 6 additions & 14 deletions plugins/custom-fields/src/Providers/ModuleProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ public function boot()
$this->publishes([
__DIR__ . '/../../database' => base_path('database'),
], 'migrations');

//Register related facades
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('CustomFieldRules', CustomFieldRules::class);
$loader->alias('RenderCustomFields', RenderCustomFields::class);
}

/**
Expand All @@ -49,19 +44,16 @@ public function boot()
public function register()
{
//Load helpers
$this->loadHelpers();
load_module_helpers(__DIR__);

//Register related facades
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias('CustomFieldRules', CustomFieldRules::class);
$loader->alias('RenderCustomFields', RenderCustomFields::class);

$this->app->register(RouteServiceProvider::class);
$this->app->register(RepositoryServiceProvider::class);
$this->app->register(HookServiceProvider::class);
$this->app->register(BootstrapModuleServiceProvider::class);
}

protected function loadHelpers()
{
$helpers = $this->app['files']->glob(__DIR__ . '/../../helpers/*.php');
foreach ($helpers as $helper) {
require_once $helper;
}
}
}
Empty file.
Empty file.
10 changes: 0 additions & 10 deletions plugins/pages/module.json

This file was deleted.

Empty file.
169 changes: 0 additions & 169 deletions plugins/pages/resources/views/admin/edit.blade.php

This file was deleted.

Loading

0 comments on commit 9cd6604

Please sign in to comment.