contents
This commit is contained in:
parent
e7fc91e0e7
commit
90da3c14a7
|
|
@ -0,0 +1,52 @@
|
||||||
|
<?php namespace AhmadFatoni\ApiGenerator\Controllers\API;
|
||||||
|
|
||||||
|
use Cms\Classes\Controller;
|
||||||
|
use BackendMenu;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use AhmadFatoni\ApiGenerator\Helpers\Helpers;
|
||||||
|
use Illuminate\Support\Facades\Validator;
|
||||||
|
|
||||||
|
use Tps\Tps\Models\About;
|
||||||
|
use Tps\Tps\Classes\ContentResource;
|
||||||
|
|
||||||
|
class ContentController extends Controller
|
||||||
|
{
|
||||||
|
protected $About;
|
||||||
|
|
||||||
|
protected $helpers;
|
||||||
|
|
||||||
|
public function __construct(About $About, Helpers $helpers)
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
$this->About = $About;
|
||||||
|
$this->helpers = $helpers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function index(Request $request){
|
||||||
|
|
||||||
|
$data = $request->all();
|
||||||
|
|
||||||
|
$validator = Validator::make($data, [
|
||||||
|
'locale' => 'required|in:ru,en,tm',
|
||||||
|
'type' => 'required|in:about',
|
||||||
|
]);
|
||||||
|
|
||||||
|
if($validator->fails()) {
|
||||||
|
return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validator->errors() );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return response()->json(ContentResource::collection($this->About::where("type", $data['type'])->get())->response()->getData(), 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static function getAfterFilters() {return [];}
|
||||||
|
public static function getBeforeFilters() {return [];}
|
||||||
|
public static function getMiddleware() {return [];}
|
||||||
|
public function callAction($method, $parameters=false) {
|
||||||
|
return call_user_func_array(array($this, $method), $parameters);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,8 @@ use Illuminate\Support\Facades\Validator;
|
||||||
use RainLab\Blog\Models\Post;
|
use RainLab\Blog\Models\Post;
|
||||||
|
|
||||||
use RainLab\Blog\Classes\PostResource;
|
use RainLab\Blog\Classes\PostResource;
|
||||||
|
use RainLab\Blog\Classes\PostDetailResource;
|
||||||
|
|
||||||
|
|
||||||
class PostsController extends Controller
|
class PostsController extends Controller
|
||||||
{
|
{
|
||||||
|
|
@ -139,9 +141,8 @@ class PostsController extends Controller
|
||||||
|
|
||||||
|
|
||||||
$data = response()->json(PostResource::collection(
|
$data = response()->json(PostResource::collection(
|
||||||
$this->Post::with(['categories:id,name'])
|
$this->Post::with(['categories'])
|
||||||
->listFrontEnd($filter)
|
->listFrontEnd($filter)
|
||||||
|
|
||||||
)->response()->getData(), 200);
|
)->response()->getData(), 200);
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
|
|
@ -182,7 +183,7 @@ class PostsController extends Controller
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new PostResource($post);
|
return new PostDetailResource($post);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,3 +14,6 @@ Route::get('api/v1/posts/{id}/delete', ['as' => 'api/v1/posts.delete', 'uses' =>
|
||||||
Route::get('api/v1/pagination/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\PostsController@indexPagination');
|
Route::get('api/v1/pagination/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\PostsController@indexPagination');
|
||||||
Route::get('api/v1/pagination/new/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\PostsController@indexPaginationLast');
|
Route::get('api/v1/pagination/new/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\PostsController@indexPaginationLast');
|
||||||
Route::get('api/v1/popular/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\PostsController@popular');
|
Route::get('api/v1/popular/posts', 'AhmadFatoni\ApiGenerator\Controllers\API\PostsController@popular');
|
||||||
|
|
||||||
|
|
||||||
|
Route::get('api/v1/content', 'AhmadFatoni\ApiGenerator\Controllers\API\ContentController@index');
|
||||||
|
|
|
||||||
|
|
@ -1,24 +1,27 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace RainLab\Blog\Classes;
|
namespace RainLab\Blog\Classes;
|
||||||
|
|
||||||
use Illuminate\Http\Resources\Json\JsonResource;
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
|
||||||
class CategoryResource extends JsonResource
|
class CategoryResource extends JsonResource
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Transform the resource into an array.
|
* Transform the resource into an array.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function toArray($request)
|
public function toArray($request)
|
||||||
{
|
{
|
||||||
$locale = $request->get('locale');
|
$locale = $request->get('locale');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'id' => $this->id,
|
'id' => $this->id,
|
||||||
'name' => $this->getAttributeTranslated('name', $locale),
|
'name' => $this->getAttributeTranslated('name', $locale),
|
||||||
];
|
'powerseo_title' => $this->getAttributeTranslated('powerseo_title', $locale),
|
||||||
}
|
'powerseo_description' => $this->getAttributeTranslated('powerseo_description', $locale),
|
||||||
}
|
'powerseo_keywords' => $this->getAttributeTranslated('powerseo_keywords', $locale),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,39 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace RainLab\Blog\Classes;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
use Config;
|
||||||
|
|
||||||
|
class PostDetailResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$locale = $request->get('locale');
|
||||||
|
$path = Config::get('app.url').Config::get('cms.storage.media.path');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'title' => $this->getAttributeTranslated('title', $locale),
|
||||||
|
'slug' => $this->getAttributeTranslated('slug', $locale),
|
||||||
|
'excerpt' => $this->getAttributeTranslated('excerpt', $locale),
|
||||||
|
'published_at' => $this->published_at->format('d.m.Y'),
|
||||||
|
'type' => $this->type,
|
||||||
|
'awtor' => $this->getAttributeTranslated('awtor', $locale),
|
||||||
|
'featured_images' => ImageResource::collection($this->featured_images),
|
||||||
|
'video' => $path.$this->video,
|
||||||
|
'views' => $this->views,
|
||||||
|
'content_html' => $this->getAttributeTranslated('content_html', $locale),
|
||||||
|
'categories' => CategoryResource::collection($this->categories),
|
||||||
|
'powerseo_title' => $this->getAttributeTranslated('powerseo_title', $locale),
|
||||||
|
'powerseo_description' => $this->getAttributeTranslated('powerseo_description', $locale),
|
||||||
|
'powerseo_keywords' => $this->getAttributeTranslated('powerseo_keywords', $locale),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -28,11 +28,11 @@ class PostResource extends JsonResource
|
||||||
'awtor' => $this->getAttributeTranslated('awtor', $locale),
|
'awtor' => $this->getAttributeTranslated('awtor', $locale),
|
||||||
'featured_images' => ImageResource::collection($this->featured_images),
|
'featured_images' => ImageResource::collection($this->featured_images),
|
||||||
'video' => $path.$this->video,
|
'video' => $path.$this->video,
|
||||||
'content_html' => $this->getAttributeTranslated('content_html', $locale),
|
//'content_html' => $this->getAttributeTranslated('content_html', $locale),
|
||||||
'categories' => CategoryResource::collection($this->categories),
|
'categories' => CategoryResource::collection($this->categories),
|
||||||
'powerseo_title' => $this->getAttributeTranslated('powerseo_title', $locale),
|
//'powerseo_title' => $this->getAttributeTranslated('powerseo_title', $locale),
|
||||||
'powerseo_description' => $this->getAttributeTranslated('powerseo_description', $locale),
|
//'powerseo_description' => $this->getAttributeTranslated('powerseo_description', $locale),
|
||||||
'powerseo_keywords' => $this->getAttributeTranslated('powerseo_keywords', $locale),
|
//'powerseo_keywords' => $this->getAttributeTranslated('powerseo_keywords', $locale),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,315 +1,318 @@
|
||||||
<?php namespace RainLab\Blog\Models;
|
<?php namespace RainLab\Blog\Models;
|
||||||
|
|
||||||
use Str;
|
use Str;
|
||||||
use Model;
|
use Model;
|
||||||
use Url;
|
use Url;
|
||||||
use Cms\Classes\Page as CmsPage;
|
use Cms\Classes\Page as CmsPage;
|
||||||
use Cms\Classes\Theme;
|
use Cms\Classes\Theme;
|
||||||
|
|
||||||
class Category extends Model
|
class Category extends Model
|
||||||
{
|
{
|
||||||
use \October\Rain\Database\Traits\Validation;
|
use \October\Rain\Database\Traits\Validation;
|
||||||
use \October\Rain\Database\Traits\NestedTree;
|
use \October\Rain\Database\Traits\NestedTree;
|
||||||
|
|
||||||
public $table = 'rainlab_blog_categories';
|
public $table = 'rainlab_blog_categories';
|
||||||
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
|
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validation
|
* Validation
|
||||||
*/
|
*/
|
||||||
public $rules = [
|
public $rules = [
|
||||||
'name' => 'required',
|
'name' => 'required',
|
||||||
'slug' => 'required|between:3,64|unique:rainlab_blog_categories',
|
'slug' => 'required|between:3,64|unique:rainlab_blog_categories',
|
||||||
'code' => 'nullable|unique:rainlab_blog_categories',
|
'code' => 'nullable|unique:rainlab_blog_categories',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array Attributes that support translation, if available.
|
* @var array Attributes that support translation, if available.
|
||||||
*/
|
*/
|
||||||
public $translatable = [
|
public $translatable = [
|
||||||
'name',
|
'name',
|
||||||
'description',
|
'description',
|
||||||
['slug', 'index' => true]
|
'powerseo_title',
|
||||||
];
|
'powerseo_description',
|
||||||
|
'powerseo_keywords',
|
||||||
protected $guarded = [];
|
['slug', 'index' => true]
|
||||||
|
];
|
||||||
public $belongsToMany = [
|
|
||||||
'posts' => ['RainLab\Blog\Models\Post',
|
protected $guarded = [];
|
||||||
'table' => 'rainlab_blog_posts_categories',
|
|
||||||
'order' => 'published_at desc',
|
public $belongsToMany = [
|
||||||
'scope' => 'isPublished'
|
'posts' => ['RainLab\Blog\Models\Post',
|
||||||
],
|
'table' => 'rainlab_blog_posts_categories',
|
||||||
'posts_count' => ['RainLab\Blog\Models\Post',
|
'order' => 'published_at desc',
|
||||||
'table' => 'rainlab_blog_posts_categories',
|
'scope' => 'isPublished'
|
||||||
'scope' => 'isPublished',
|
],
|
||||||
'count' => true
|
'posts_count' => ['RainLab\Blog\Models\Post',
|
||||||
]
|
'table' => 'rainlab_blog_posts_categories',
|
||||||
];
|
'scope' => 'isPublished',
|
||||||
|
'count' => true
|
||||||
public function beforeValidate()
|
]
|
||||||
{
|
];
|
||||||
// Generate a URL slug for this model
|
|
||||||
if (!$this->exists && !$this->slug) {
|
public function beforeValidate()
|
||||||
$this->slug = Str::slug($this->name);
|
{
|
||||||
}
|
// Generate a URL slug for this model
|
||||||
}
|
if (!$this->exists && !$this->slug) {
|
||||||
|
$this->slug = Str::slug($this->name);
|
||||||
public function afterDelete()
|
}
|
||||||
{
|
}
|
||||||
$this->posts()->detach();
|
|
||||||
}
|
public function afterDelete()
|
||||||
|
{
|
||||||
public function getPostCountAttribute()
|
$this->posts()->detach();
|
||||||
{
|
}
|
||||||
return optional($this->posts_count->first())->count ?? 0;
|
|
||||||
}
|
public function getPostCountAttribute()
|
||||||
|
{
|
||||||
/**
|
return optional($this->posts_count->first())->count ?? 0;
|
||||||
* Count posts in this and nested categories
|
}
|
||||||
* @return int
|
|
||||||
*/
|
/**
|
||||||
public function getNestedPostCount()
|
* Count posts in this and nested categories
|
||||||
{
|
* @return int
|
||||||
return $this->post_count + $this->children->sum(function ($category) {
|
*/
|
||||||
return $category->getNestedPostCount();
|
public function getNestedPostCount()
|
||||||
});
|
{
|
||||||
}
|
return $this->post_count + $this->children->sum(function ($category) {
|
||||||
|
return $category->getNestedPostCount();
|
||||||
/**
|
});
|
||||||
* Sets the "url" attribute with a URL to this object
|
}
|
||||||
*
|
|
||||||
* @param string $pageName
|
/**
|
||||||
* @param Cms\Classes\Controller $controller
|
* Sets the "url" attribute with a URL to this object
|
||||||
*
|
*
|
||||||
* @return string
|
* @param string $pageName
|
||||||
*/
|
* @param Cms\Classes\Controller $controller
|
||||||
public function setUrl($pageName, $controller)
|
*
|
||||||
{
|
* @return string
|
||||||
$params = [
|
*/
|
||||||
'id' => $this->id,
|
public function setUrl($pageName, $controller)
|
||||||
'slug' => $this->slug
|
{
|
||||||
];
|
$params = [
|
||||||
|
'id' => $this->id,
|
||||||
return $this->url = $controller->pageUrl($pageName, $params, false);
|
'slug' => $this->slug
|
||||||
}
|
];
|
||||||
|
|
||||||
/**
|
return $this->url = $controller->pageUrl($pageName, $params, false);
|
||||||
* Handler for the pages.menuitem.getTypeInfo event.
|
}
|
||||||
* Returns a menu item type information. The type information is returned as array
|
|
||||||
* with the following elements:
|
/**
|
||||||
* - references - a list of the item type reference options. The options are returned in the
|
* Handler for the pages.menuitem.getTypeInfo event.
|
||||||
* ["key"] => "title" format for options that don't have sub-options, and in the format
|
* Returns a menu item type information. The type information is returned as array
|
||||||
* ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional,
|
* with the following elements:
|
||||||
* required only if the menu item type requires references.
|
* - references - a list of the item type reference options. The options are returned in the
|
||||||
* - nesting - Boolean value indicating whether the item type supports nested items. Optional,
|
* ["key"] => "title" format for options that don't have sub-options, and in the format
|
||||||
* false if omitted.
|
* ["key"] => ["title"=>"Option title", "items"=>[...]] for options that have sub-options. Optional,
|
||||||
* - dynamicItems - Boolean value indicating whether the item type could generate new menu items.
|
* required only if the menu item type requires references.
|
||||||
* Optional, false if omitted.
|
* - nesting - Boolean value indicating whether the item type supports nested items. Optional,
|
||||||
* - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to
|
* false if omitted.
|
||||||
* resolve the item URL.
|
* - dynamicItems - Boolean value indicating whether the item type could generate new menu items.
|
||||||
* @param string $type Specifies the menu item type
|
* Optional, false if omitted.
|
||||||
* @return array Returns an array
|
* - cmsPages - a list of CMS pages (objects of the Cms\Classes\Page class), if the item type requires a CMS page reference to
|
||||||
*/
|
* resolve the item URL.
|
||||||
public static function getMenuTypeInfo($type)
|
* @param string $type Specifies the menu item type
|
||||||
{
|
* @return array Returns an array
|
||||||
$result = [];
|
*/
|
||||||
|
public static function getMenuTypeInfo($type)
|
||||||
if ($type == 'blog-category') {
|
{
|
||||||
$result = [
|
$result = [];
|
||||||
'references' => self::listSubCategoryOptions(),
|
|
||||||
'nesting' => true,
|
if ($type == 'blog-category') {
|
||||||
'dynamicItems' => true
|
$result = [
|
||||||
];
|
'references' => self::listSubCategoryOptions(),
|
||||||
}
|
'nesting' => true,
|
||||||
|
'dynamicItems' => true
|
||||||
if ($type == 'all-blog-categories') {
|
];
|
||||||
$result = [
|
}
|
||||||
'dynamicItems' => true
|
|
||||||
];
|
if ($type == 'all-blog-categories') {
|
||||||
}
|
$result = [
|
||||||
|
'dynamicItems' => true
|
||||||
if ($result) {
|
];
|
||||||
$theme = Theme::getActiveTheme();
|
}
|
||||||
|
|
||||||
$pages = CmsPage::listInTheme($theme, true);
|
if ($result) {
|
||||||
$cmsPages = [];
|
$theme = Theme::getActiveTheme();
|
||||||
foreach ($pages as $page) {
|
|
||||||
if (!$page->hasComponent('blogPosts')) {
|
$pages = CmsPage::listInTheme($theme, true);
|
||||||
continue;
|
$cmsPages = [];
|
||||||
}
|
foreach ($pages as $page) {
|
||||||
|
if (!$page->hasComponent('blogPosts')) {
|
||||||
/*
|
continue;
|
||||||
* Component must use a category filter with a routing parameter
|
}
|
||||||
* eg: categoryFilter = "{{ :somevalue }}"
|
|
||||||
*/
|
/*
|
||||||
$properties = $page->getComponentProperties('blogPosts');
|
* Component must use a category filter with a routing parameter
|
||||||
if (!isset($properties['categoryFilter']) || !preg_match('/{{\s*:/', $properties['categoryFilter'])) {
|
* eg: categoryFilter = "{{ :somevalue }}"
|
||||||
continue;
|
*/
|
||||||
}
|
$properties = $page->getComponentProperties('blogPosts');
|
||||||
|
if (!isset($properties['categoryFilter']) || !preg_match('/{{\s*:/', $properties['categoryFilter'])) {
|
||||||
$cmsPages[] = $page;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$result['cmsPages'] = $cmsPages;
|
$cmsPages[] = $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $result;
|
$result['cmsPages'] = $cmsPages;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function listSubCategoryOptions()
|
return $result;
|
||||||
{
|
}
|
||||||
$category = self::getNested();
|
|
||||||
|
protected static function listSubCategoryOptions()
|
||||||
$iterator = function($categories) use (&$iterator) {
|
{
|
||||||
$result = [];
|
$category = self::getNested();
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
$iterator = function($categories) use (&$iterator) {
|
||||||
if (!$category->children) {
|
$result = [];
|
||||||
$result[$category->id] = $category->name;
|
|
||||||
}
|
foreach ($categories as $category) {
|
||||||
else {
|
if (!$category->children) {
|
||||||
$result[$category->id] = [
|
$result[$category->id] = $category->name;
|
||||||
'title' => $category->name,
|
}
|
||||||
'items' => $iterator($category->children)
|
else {
|
||||||
];
|
$result[$category->id] = [
|
||||||
}
|
'title' => $category->name,
|
||||||
}
|
'items' => $iterator($category->children)
|
||||||
|
];
|
||||||
return $result;
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
return $iterator($category);
|
return $result;
|
||||||
}
|
};
|
||||||
|
|
||||||
/**
|
return $iterator($category);
|
||||||
* Handler for the pages.menuitem.resolveItem event.
|
}
|
||||||
* Returns information about a menu item. The result is an array
|
|
||||||
* with the following keys:
|
/**
|
||||||
* - url - the menu item URL. Not required for menu item types that return all available records.
|
* Handler for the pages.menuitem.resolveItem event.
|
||||||
* The URL should be returned relative to the website root and include the subdirectory, if any.
|
* Returns information about a menu item. The result is an array
|
||||||
* Use the Url::to() helper to generate the URLs.
|
* with the following keys:
|
||||||
* - isActive - determines whether the menu item is active. Not required for menu item types that
|
* - url - the menu item URL. Not required for menu item types that return all available records.
|
||||||
* return all available records.
|
* The URL should be returned relative to the website root and include the subdirectory, if any.
|
||||||
* - items - an array of arrays with the same keys (url, isActive, items) + the title key.
|
* Use the Url::to() helper to generate the URLs.
|
||||||
* The items array should be added only if the $item's $nesting property value is TRUE.
|
* - isActive - determines whether the menu item is active. Not required for menu item types that
|
||||||
* @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item.
|
* return all available records.
|
||||||
* @param \Cms\Classes\Theme $theme Specifies the current theme.
|
* - items - an array of arrays with the same keys (url, isActive, items) + the title key.
|
||||||
* @param string $url Specifies the current page URL, normalized, in lower case
|
* The items array should be added only if the $item's $nesting property value is TRUE.
|
||||||
* The URL is specified relative to the website root, it includes the subdirectory name, if any.
|
* @param \RainLab\Pages\Classes\MenuItem $item Specifies the menu item.
|
||||||
* @return mixed Returns an array. Returns null if the item cannot be resolved.
|
* @param \Cms\Classes\Theme $theme Specifies the current theme.
|
||||||
*/
|
* @param string $url Specifies the current page URL, normalized, in lower case
|
||||||
public static function resolveMenuItem($item, $url, $theme)
|
* The URL is specified relative to the website root, it includes the subdirectory name, if any.
|
||||||
{
|
* @return mixed Returns an array. Returns null if the item cannot be resolved.
|
||||||
$result = null;
|
*/
|
||||||
|
public static function resolveMenuItem($item, $url, $theme)
|
||||||
if ($item->type == 'blog-category') {
|
{
|
||||||
if (!$item->reference || !$item->cmsPage) {
|
$result = null;
|
||||||
return;
|
|
||||||
}
|
if ($item->type == 'blog-category') {
|
||||||
|
if (!$item->reference || !$item->cmsPage) {
|
||||||
$category = self::find($item->reference);
|
return;
|
||||||
if (!$category) {
|
}
|
||||||
return;
|
|
||||||
}
|
$category = self::find($item->reference);
|
||||||
|
if (!$category) {
|
||||||
$pageUrl = self::getCategoryPageUrl($item->cmsPage, $category, $theme);
|
return;
|
||||||
if (!$pageUrl) {
|
}
|
||||||
return;
|
|
||||||
}
|
$pageUrl = self::getCategoryPageUrl($item->cmsPage, $category, $theme);
|
||||||
|
if (!$pageUrl) {
|
||||||
$pageUrl = Url::to($pageUrl);
|
return;
|
||||||
|
}
|
||||||
$result = [];
|
|
||||||
$result['url'] = $pageUrl;
|
$pageUrl = Url::to($pageUrl);
|
||||||
$result['isActive'] = $pageUrl == $url;
|
|
||||||
$result['mtime'] = $category->updated_at;
|
$result = [];
|
||||||
|
$result['url'] = $pageUrl;
|
||||||
if ($item->nesting) {
|
$result['isActive'] = $pageUrl == $url;
|
||||||
$iterator = function($categories) use (&$iterator, &$item, &$theme, $url) {
|
$result['mtime'] = $category->updated_at;
|
||||||
$branch = [];
|
|
||||||
|
if ($item->nesting) {
|
||||||
foreach ($categories as $category) {
|
$iterator = function($categories) use (&$iterator, &$item, &$theme, $url) {
|
||||||
|
$branch = [];
|
||||||
$branchItem = [];
|
|
||||||
$branchItem['url'] = self::getCategoryPageUrl($item->cmsPage, $category, $theme);
|
foreach ($categories as $category) {
|
||||||
$branchItem['isActive'] = $branchItem['url'] == $url;
|
|
||||||
$branchItem['title'] = $category->name;
|
$branchItem = [];
|
||||||
$branchItem['mtime'] = $category->updated_at;
|
$branchItem['url'] = self::getCategoryPageUrl($item->cmsPage, $category, $theme);
|
||||||
|
$branchItem['isActive'] = $branchItem['url'] == $url;
|
||||||
if ($category->children) {
|
$branchItem['title'] = $category->name;
|
||||||
$branchItem['items'] = $iterator($category->children);
|
$branchItem['mtime'] = $category->updated_at;
|
||||||
}
|
|
||||||
|
if ($category->children) {
|
||||||
$branch[] = $branchItem;
|
$branchItem['items'] = $iterator($category->children);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $branch;
|
$branch[] = $branchItem;
|
||||||
};
|
}
|
||||||
|
|
||||||
$result['items'] = $iterator($category->children);
|
return $branch;
|
||||||
}
|
};
|
||||||
}
|
|
||||||
elseif ($item->type == 'all-blog-categories') {
|
$result['items'] = $iterator($category->children);
|
||||||
$result = [
|
}
|
||||||
'items' => []
|
}
|
||||||
];
|
elseif ($item->type == 'all-blog-categories') {
|
||||||
|
$result = [
|
||||||
$categories = self::with('posts_count')->orderBy('name')->get();
|
'items' => []
|
||||||
foreach ($categories as $category) {
|
];
|
||||||
try {
|
|
||||||
$postCount = $category->posts_count->first()->count ?? null;
|
$categories = self::with('posts_count')->orderBy('name')->get();
|
||||||
if ($postCount === 0) {
|
foreach ($categories as $category) {
|
||||||
continue;
|
try {
|
||||||
}
|
$postCount = $category->posts_count->first()->count ?? null;
|
||||||
}
|
if ($postCount === 0) {
|
||||||
catch (\Exception $ex) {}
|
continue;
|
||||||
|
}
|
||||||
$categoryItem = [
|
}
|
||||||
'title' => $category->name,
|
catch (\Exception $ex) {}
|
||||||
'url' => self::getCategoryPageUrl($item->cmsPage, $category, $theme),
|
|
||||||
'mtime' => $category->updated_at
|
$categoryItem = [
|
||||||
];
|
'title' => $category->name,
|
||||||
|
'url' => self::getCategoryPageUrl($item->cmsPage, $category, $theme),
|
||||||
$categoryItem['isActive'] = $categoryItem['url'] == $url;
|
'mtime' => $category->updated_at
|
||||||
|
];
|
||||||
$result['items'][] = $categoryItem;
|
|
||||||
}
|
$categoryItem['isActive'] = $categoryItem['url'] == $url;
|
||||||
}
|
|
||||||
|
$result['items'][] = $categoryItem;
|
||||||
return $result;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
return $result;
|
||||||
* Returns URL of a category page.
|
}
|
||||||
*
|
|
||||||
* @param $pageCode
|
/**
|
||||||
* @param $category
|
* Returns URL of a category page.
|
||||||
* @param $theme
|
*
|
||||||
*/
|
* @param $pageCode
|
||||||
protected static function getCategoryPageUrl($pageCode, $category, $theme)
|
* @param $category
|
||||||
{
|
* @param $theme
|
||||||
$page = CmsPage::loadCached($theme, $pageCode);
|
*/
|
||||||
if (!$page) {
|
protected static function getCategoryPageUrl($pageCode, $category, $theme)
|
||||||
return;
|
{
|
||||||
}
|
$page = CmsPage::loadCached($theme, $pageCode);
|
||||||
|
if (!$page) {
|
||||||
$properties = $page->getComponentProperties('blogPosts');
|
return;
|
||||||
if (!isset($properties['categoryFilter'])) {
|
}
|
||||||
return;
|
|
||||||
}
|
$properties = $page->getComponentProperties('blogPosts');
|
||||||
|
if (!isset($properties['categoryFilter'])) {
|
||||||
/*
|
return;
|
||||||
* Extract the routing parameter name from the category filter
|
}
|
||||||
* eg: {{ :someRouteParam }}
|
|
||||||
*/
|
/*
|
||||||
if (!preg_match('/^\{\{([^\}]+)\}\}$/', $properties['categoryFilter'], $matches)) {
|
* Extract the routing parameter name from the category filter
|
||||||
return;
|
* eg: {{ :someRouteParam }}
|
||||||
}
|
*/
|
||||||
|
if (!preg_match('/^\{\{([^\}]+)\}\}$/', $properties['categoryFilter'], $matches)) {
|
||||||
$paramName = substr(trim($matches[1]), 1);
|
return;
|
||||||
$url = CmsPage::url($page->getBaseFileName(), [$paramName => $category->slug]);
|
}
|
||||||
|
|
||||||
return $url;
|
$paramName = substr(trim($matches[1]), 1);
|
||||||
}
|
$url = CmsPage::url($page->getBaseFileName(), [$paramName => $category->slug]);
|
||||||
}
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,30 @@
|
||||||
# ===================================
|
|
||||||
# Field Definitions
|
|
||||||
# ===================================
|
|
||||||
|
|
||||||
fields:
|
fields:
|
||||||
|
|
||||||
name:
|
name:
|
||||||
label: rainlab.blog::lang.category.name
|
label: 'rainlab.blog::lang.category.name'
|
||||||
placeholder: rainlab.blog::lang.category.name_placeholder
|
placeholder: 'rainlab.blog::lang.category.name_placeholder'
|
||||||
span: left
|
span: left
|
||||||
|
type: text
|
||||||
slug:
|
slug:
|
||||||
label: rainlab.blog::lang.category.slug
|
label: 'rainlab.blog::lang.category.slug'
|
||||||
span: right
|
span: right
|
||||||
placeholder: rainlab.blog::lang.category.slug_placeholder
|
placeholder: 'rainlab.blog::lang.category.slug_placeholder'
|
||||||
preset: name
|
preset: name
|
||||||
|
type: text
|
||||||
description:
|
description:
|
||||||
label: 'rainlab.blog::lang.category.description'
|
label: 'rainlab.blog::lang.category.description'
|
||||||
size: large
|
size: large
|
||||||
oc.commentPosition: ''
|
oc.commentPosition: ''
|
||||||
span: full
|
span: full
|
||||||
type: textarea
|
type: textarea
|
||||||
|
powerseo_title:
|
||||||
|
label: 'Powerseo title'
|
||||||
|
span: auto
|
||||||
|
type: text
|
||||||
|
powerseo_description:
|
||||||
|
label: 'Powerseo description'
|
||||||
|
span: auto
|
||||||
|
type: text
|
||||||
|
powerseo_keywords:
|
||||||
|
label: 'Powerseo keywords'
|
||||||
|
span: auto
|
||||||
|
type: text
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php namespace RainLab\Blog\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableUpdateRainlabBlogCategories extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('rainlab_blog_categories', function($table)
|
||||||
|
{
|
||||||
|
$table->string('powerseo_title')->nullable();
|
||||||
|
$table->string('powerseo_description')->nullable();
|
||||||
|
$table->string('powerseo_keywords')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('rainlab_blog_categories', function($table)
|
||||||
|
{
|
||||||
|
$table->dropColumn('powerseo_title');
|
||||||
|
$table->dropColumn('powerseo_description');
|
||||||
|
$table->dropColumn('powerseo_keywords');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -79,3 +79,6 @@
|
||||||
1.6.6:
|
1.6.6:
|
||||||
- 'Updated table rainlab_blog_posts'
|
- 'Updated table rainlab_blog_posts'
|
||||||
- builder_table_update_rainlab_blog_posts_4.php
|
- builder_table_update_rainlab_blog_posts_4.php
|
||||||
|
1.6.7:
|
||||||
|
- 'Updated table rainlab_blog_categories'
|
||||||
|
- builder_table_update_rainlab_blog_categories.php
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?php namespace Tps\Tps;
|
||||||
|
|
||||||
|
use System\Classes\PluginBase;
|
||||||
|
|
||||||
|
class Plugin extends PluginBase
|
||||||
|
{
|
||||||
|
public function registerComponents()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function registerSettings()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Tps\Tps\Classes;
|
||||||
|
|
||||||
|
use Illuminate\Http\Resources\Json\JsonResource;
|
||||||
|
use Config;
|
||||||
|
|
||||||
|
class ContentResource extends JsonResource
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Transform the resource into an array.
|
||||||
|
*
|
||||||
|
* @param \Illuminate\Http\Request $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function toArray($request)
|
||||||
|
{
|
||||||
|
$locale = $request->get('locale');
|
||||||
|
|
||||||
|
return [
|
||||||
|
'id' => $this->id,
|
||||||
|
'name' => $this->name,
|
||||||
|
'type' => $this->type,
|
||||||
|
'content' => $this->getAttributeTranslated('content', $locale),
|
||||||
|
'title' => $this->getAttributeTranslated('title', $locale),
|
||||||
|
'powerseo_title' => $this->getAttributeTranslated('powerseo_title', $locale),
|
||||||
|
'powerseo_description' => $this->getAttributeTranslated('powerseo_description', $locale),
|
||||||
|
'powerseo_keywords' => $this->getAttributeTranslated('powerseo_keywords', $locale),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?php namespace Tps\Tps\Controllers;
|
||||||
|
|
||||||
|
use Backend\Classes\Controller;
|
||||||
|
use BackendMenu;
|
||||||
|
|
||||||
|
class About extends Controller
|
||||||
|
{
|
||||||
|
public $implement = [ 'Backend\Behaviors\ListController', 'Backend\Behaviors\FormController' ];
|
||||||
|
|
||||||
|
public $listConfig = 'config_list.yaml';
|
||||||
|
public $formConfig = 'config_form.yaml';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
BackendMenu::setContext('Tps.Tps', 'main-menu-item');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<div data-control="toolbar">
|
||||||
|
<a href="<?= Backend::url('tps/tps/about/create') ?>" class="btn btn-primary oc-icon-plus"><?= e(trans('backend::lang.form.create')) ?></a>
|
||||||
|
<button
|
||||||
|
class="btn btn-default oc-icon-trash-o"
|
||||||
|
disabled="disabled"
|
||||||
|
onclick="$(this).data('request-data', {
|
||||||
|
checked: $('.control-list').listWidget('getChecked')
|
||||||
|
})"
|
||||||
|
data-request="onDelete"
|
||||||
|
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||||
|
data-trigger-action="enable"
|
||||||
|
data-trigger=".control-list input[type=checkbox]"
|
||||||
|
data-trigger-condition="checked"
|
||||||
|
data-request-success="$(this).prop('disabled', true)"
|
||||||
|
data-stripe-load-indicator>
|
||||||
|
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
name: About
|
||||||
|
form: $/tps/tps/models/about/fields.yaml
|
||||||
|
modelClass: Tps\Tps\Models\About
|
||||||
|
defaultRedirect: tps/tps/about
|
||||||
|
create:
|
||||||
|
redirect: 'tps/tps/about/update/:id'
|
||||||
|
redirectClose: tps/tps/about
|
||||||
|
update:
|
||||||
|
redirect: tps/tps/about
|
||||||
|
redirectClose: tps/tps/about
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
list: $/tps/tps/models/about/columns.yaml
|
||||||
|
modelClass: Tps\Tps\Models\About
|
||||||
|
title: About
|
||||||
|
noRecordsMessage: 'backend::lang.list.no_records'
|
||||||
|
showSetup: true
|
||||||
|
showCheckboxes: true
|
||||||
|
recordsPerPage: 20
|
||||||
|
toolbar:
|
||||||
|
buttons: list_toolbar
|
||||||
|
search:
|
||||||
|
prompt: 'backend::lang.list.search_prompt'
|
||||||
|
recordUrl: 'tps/tps/about/update/:id'
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php Block::put('breadcrumb') ?>
|
||||||
|
<ul>
|
||||||
|
<li><a href="<?= Backend::url('tps/tps/about') ?>">About</a></li>
|
||||||
|
<li><?= e($this->pageTitle) ?></li>
|
||||||
|
</ul>
|
||||||
|
<?php Block::endPut() ?>
|
||||||
|
|
||||||
|
<?php if (!$this->fatalError): ?>
|
||||||
|
|
||||||
|
<?= Form::open(['class' => 'layout']) ?>
|
||||||
|
|
||||||
|
<div class="layout-row">
|
||||||
|
<?= $this->formRender() ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-buttons">
|
||||||
|
<div class="loading-indicator-container">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
data-request="onSave"
|
||||||
|
data-hotkey="ctrl+s, cmd+s"
|
||||||
|
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||||
|
class="btn btn-primary">
|
||||||
|
<?= e(trans('backend::lang.form.create')) ?>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-request="onSave"
|
||||||
|
data-request-data="close:1"
|
||||||
|
data-hotkey="ctrl+enter, cmd+enter"
|
||||||
|
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||||
|
class="btn btn-default">
|
||||||
|
<?= e(trans('backend::lang.form.create_and_close')) ?>
|
||||||
|
</button>
|
||||||
|
<span class="btn-text">
|
||||||
|
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/tps/about') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?= Form::close() ?>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||||
|
<p><a href="<?= Backend::url('tps/tps/about') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||||
|
<?php endif ?>
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
<?= $this->listRender() ?>
|
||||||
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php Block::put('breadcrumb') ?>
|
||||||
|
<ul>
|
||||||
|
<li><a href="<?= Backend::url('tps/tps/about') ?>">About</a></li>
|
||||||
|
<li><?= e($this->pageTitle) ?></li>
|
||||||
|
</ul>
|
||||||
|
<?php Block::endPut() ?>
|
||||||
|
|
||||||
|
<?php if (!$this->fatalError): ?>
|
||||||
|
|
||||||
|
<div class="form-preview">
|
||||||
|
<?= $this->formRenderPreview() ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="flash-message static error"><?= e($this->fatalError) ?></p>
|
||||||
|
<?php endif ?>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="<?= Backend::url('tps/tps/about') ?>" class="btn btn-default oc-icon-chevron-left">
|
||||||
|
<?= e(trans('backend::lang.form.return_to_list')) ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
<?php Block::put('breadcrumb') ?>
|
||||||
|
<ul>
|
||||||
|
<li><a href="<?= Backend::url('tps/tps/about') ?>">About</a></li>
|
||||||
|
<li><?= e($this->pageTitle) ?></li>
|
||||||
|
</ul>
|
||||||
|
<?php Block::endPut() ?>
|
||||||
|
|
||||||
|
<?php if (!$this->fatalError): ?>
|
||||||
|
|
||||||
|
<?= Form::open(['class' => 'layout']) ?>
|
||||||
|
|
||||||
|
<div class="layout-row">
|
||||||
|
<?= $this->formRender() ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-buttons">
|
||||||
|
<div class="loading-indicator-container">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
data-request="onSave"
|
||||||
|
data-request-data="redirect:0"
|
||||||
|
data-hotkey="ctrl+s, cmd+s"
|
||||||
|
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||||
|
class="btn btn-primary">
|
||||||
|
<?= e(trans('backend::lang.form.save')) ?>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
data-request="onSave"
|
||||||
|
data-request-data="close:1"
|
||||||
|
data-hotkey="ctrl+enter, cmd+enter"
|
||||||
|
data-load-indicator="<?= e(trans('backend::lang.form.saving')) ?>"
|
||||||
|
class="btn btn-default">
|
||||||
|
<?= e(trans('backend::lang.form.save_and_close')) ?>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="oc-icon-trash-o btn-icon danger pull-right"
|
||||||
|
data-request="onDelete"
|
||||||
|
data-load-indicator="<?= e(trans('backend::lang.form.deleting')) ?>"
|
||||||
|
data-request-confirm="<?= e(trans('backend::lang.form.confirm_delete')) ?>">
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<span class="btn-text">
|
||||||
|
<?= e(trans('backend::lang.form.or')) ?> <a href="<?= Backend::url('tps/tps/about') ?>"><?= e(trans('backend::lang.form.cancel')) ?></a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?= Form::close() ?>
|
||||||
|
|
||||||
|
<?php else: ?>
|
||||||
|
<p class="flash-message static error"><?= e(trans($this->fatalError)) ?></p>
|
||||||
|
<p><a href="<?= Backend::url('tps/tps/about') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
|
||||||
|
<?php endif ?>
|
||||||
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?php return [
|
||||||
|
'plugin' => [
|
||||||
|
'name' => 'tps',
|
||||||
|
'description' => ''
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
@ -0,0 +1,46 @@
|
||||||
|
<?php namespace Tps\Tps\Models;
|
||||||
|
|
||||||
|
use Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model
|
||||||
|
*/
|
||||||
|
class About extends Model
|
||||||
|
{
|
||||||
|
use \October\Rain\Database\Traits\Validation;
|
||||||
|
|
||||||
|
use \October\Rain\Database\Traits\SoftDelete;
|
||||||
|
|
||||||
|
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
|
||||||
|
|
||||||
|
protected $dates = ['deleted_at'];
|
||||||
|
|
||||||
|
|
||||||
|
public $table = 'tps_tps_about';
|
||||||
|
|
||||||
|
public $rules = [
|
||||||
|
'title' => 'required',
|
||||||
|
'powerseo_title' => 'required',
|
||||||
|
'powerseo_description' => 'required',
|
||||||
|
'powerseo_keywords' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The database table used by the model.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public $translatable = [
|
||||||
|
'title',
|
||||||
|
'content',
|
||||||
|
'powerseo_title',
|
||||||
|
'powerseo_description',
|
||||||
|
'powerseo_keywords',
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Validation rules
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
columns:
|
||||||
|
id:
|
||||||
|
label: id
|
||||||
|
type: number
|
||||||
|
searchable: false
|
||||||
|
sortable: true
|
||||||
|
created_at:
|
||||||
|
label: created_at
|
||||||
|
type: datetime
|
||||||
|
searchable: false
|
||||||
|
sortable: true
|
||||||
|
type:
|
||||||
|
label: type
|
||||||
|
type: text
|
||||||
|
sortable: true
|
||||||
|
name:
|
||||||
|
label: name
|
||||||
|
type: text
|
||||||
|
searchable: true
|
||||||
|
sortable: true
|
||||||
|
note:
|
||||||
|
label: note
|
||||||
|
type: text
|
||||||
|
sortable: true
|
||||||
|
|
@ -0,0 +1,50 @@
|
||||||
|
tabs:
|
||||||
|
fields:
|
||||||
|
title:
|
||||||
|
label: Title
|
||||||
|
span: auto
|
||||||
|
required: 1
|
||||||
|
type: text
|
||||||
|
tab: Contents
|
||||||
|
name:
|
||||||
|
label: Name
|
||||||
|
span: auto
|
||||||
|
type: text
|
||||||
|
tab: Contents
|
||||||
|
content:
|
||||||
|
label: Content
|
||||||
|
size: ''
|
||||||
|
span: auto
|
||||||
|
type: richeditor
|
||||||
|
tab: Contents
|
||||||
|
note:
|
||||||
|
label: Note
|
||||||
|
span: auto
|
||||||
|
type: text
|
||||||
|
tab: Contents
|
||||||
|
type:
|
||||||
|
label: 'Content Type'
|
||||||
|
span: auto
|
||||||
|
options:
|
||||||
|
about: about
|
||||||
|
default: about
|
||||||
|
type: balloon-selector
|
||||||
|
tab: Contents
|
||||||
|
powerseo_title:
|
||||||
|
label: 'Power seo title'
|
||||||
|
span: auto
|
||||||
|
required: 1
|
||||||
|
type: text
|
||||||
|
tab: 'Seo Settings'
|
||||||
|
powerseo_description:
|
||||||
|
label: 'Powerseo description'
|
||||||
|
span: auto
|
||||||
|
required: 1
|
||||||
|
type: text
|
||||||
|
tab: 'Seo Settings'
|
||||||
|
powerseo_keywords:
|
||||||
|
label: 'Powerseo keywords'
|
||||||
|
span: auto
|
||||||
|
required: 1
|
||||||
|
type: text
|
||||||
|
tab: 'Seo Settings'
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
plugin:
|
||||||
|
name: 'tps.tps::lang.plugin.name'
|
||||||
|
description: 'tps.tps::lang.plugin.description'
|
||||||
|
author: tps
|
||||||
|
icon: oc-icon-align-justify
|
||||||
|
homepage: ''
|
||||||
|
navigation:
|
||||||
|
main-menu-item:
|
||||||
|
label: 'About Us'
|
||||||
|
url: tps/tps/about
|
||||||
|
icon: icon-align-justify
|
||||||
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php namespace Tps\Tps\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableCreateTpsTpsAbout extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->engine = 'InnoDB';
|
||||||
|
$table->increments('id')->unsigned();
|
||||||
|
$table->timestamp('created_at')->nullable();
|
||||||
|
$table->timestamp('updated_at')->nullable();
|
||||||
|
$table->timestamp('deleted_at')->nullable();
|
||||||
|
$table->string('type')->nullable();
|
||||||
|
$table->string('name')->nullable();
|
||||||
|
$table->text('content')->nullable();
|
||||||
|
$table->string('note')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('tps_tps_about');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
<?php namespace Tps\Tps\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableUpdateTpsTpsAbout extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->string('power_seo_title')->nullable();
|
||||||
|
$table->string('powerseo_description')->nullable();
|
||||||
|
$table->string('powerseo_keywords')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->dropColumn('power_seo_title');
|
||||||
|
$table->dropColumn('powerseo_description');
|
||||||
|
$table->dropColumn('powerseo_keywords');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php namespace Tps\Tps\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableUpdateTpsTpsAbout2 extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->string('title')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->dropColumn('title');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?php namespace Tps\Tps\Updates;
|
||||||
|
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableUpdateTpsTpsAbout3 extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->renameColumn('power_seo_title', 'powerseo_title');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('tps_tps_about', function($table)
|
||||||
|
{
|
||||||
|
$table->renameColumn('powerseo_title', 'power_seo_title');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
1.0.1:
|
||||||
|
- 'Initialize plugin.'
|
||||||
|
1.0.2:
|
||||||
|
- 'Created table tps_tps_about'
|
||||||
|
- builder_table_create_tps_tps_about.php
|
||||||
|
1.0.3:
|
||||||
|
- 'Updated table tps_tps_about'
|
||||||
|
- builder_table_update_tps_tps_about.php
|
||||||
|
1.0.4:
|
||||||
|
- 'Updated table tps_tps_about'
|
||||||
|
- builder_table_update_tps_tps_about_2.php
|
||||||
|
1.0.5:
|
||||||
|
- 'Updated table tps_tps_about'
|
||||||
|
- builder_table_update_tps_tps_about_3.php
|
||||||
Loading…
Reference in New Issue