from server 31.10

This commit is contained in:
Shohrat 2023-10-31 05:19:41 +00:00
parent 6fe7679a02
commit 31f7e49256
30 changed files with 468 additions and 40 deletions

View File

@ -57,9 +57,9 @@ return [
'engine' => 'InnoDB', 'engine' => 'InnoDB',
'host' => 'localhost', 'host' => 'localhost',
'port' => 3306, 'port' => 3306,
'database' => 'airport2023', 'database' => 'airport',
'username' => 'shohrat', 'username' => 'shohrat',
'password' => 'bt110226', 'password' => 'qazwsx12**',
'charset' => 'utf8mb4', 'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci', 'collation' => 'utf8mb4_unicode_ci',
'prefix' => '', 'prefix' => '',

View File

@ -69,7 +69,7 @@ class postController extends Controller
$dataVal = $request->all(); $dataVal = $request->all();
$data = Post::with(['categories:id,name', 'featured_images']) $data = Post::with(['categories:id,name', 'featured_images'])
->select('id', 'title', 'published_at', 'slug', 'excerpt', 'content_html') ->select('id', 'title', 'published_at', 'slug', 'excerpt', 'content_html', 'meta_title', 'meta_description', 'meta_keywords')
->with('views') ->with('views')
->find($id); ->find($id);

View File

@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Validator;
use tps\Airport\Models\Content; use tps\Airport\Models\Content;
use tps\Airport\Models\Menu; use tps\Airport\Models\Menu;
use Config; use Config;
use Tps\Pageview\Models\PageVisit as ViewModel;
use Carbon\Carbon;
class sectionController extends Controller class sectionController extends Controller
@ -31,9 +33,18 @@ class sectionController extends Controller
return Validator::make($data, $rules); return Validator::make($data, $rules);
} }
public function visit($page){
//dump($data['page']);
if($page){
$view = ViewModel::firstOrCreate(['page' => $page, 'date' => Carbon::today()]);
$view->increment('view');
}
return ViewModel::where('page', $page)->sum('view');
}
public function index(Request $request) public function index(Request $request)
{ {
$path = 'http://216.250.8.104:8081' . Config::get('cms.storage.media.path'); $path = 'https://www.ashgabatairport.gov.tm/app' . Config::get('cms.storage.media.path');
$dataVal = $request->all(); $dataVal = $request->all();
@ -47,7 +58,7 @@ class sectionController extends Controller
return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validator->errors()); return $this->helpers->apiArrayResponseBuilder(400, 'fail', $validator->errors());
} }
$data = Content::where('menu_slug', input('page'))->select('id', 'note', 'menu_slug', 'data')->get(); $data = Content::where('menu_slug', input('page'))->select('id', 'note', 'menu_slug', 'data', 'meta_title', 'meta_description', 'meta_keywords')->get();
if (count($data) != 0) { if (count($data) != 0) {
@ -98,6 +109,7 @@ class sectionController extends Controller
$data->makeHidden(['data']); $data->makeHidden(['data']);
$data[0]->visit = $this->visit(input('page'));
// dd($data[0]->data); // dd($data[0]->data);
return $this->helpers->apiArrayResponseBuilder(200, 'success', $data); return $this->helpers->apiArrayResponseBuilder(200, 'success', $data);
} else { } else {

View File

@ -46,6 +46,9 @@ class Post extends Model
'content_html', 'content_html',
'excerpt', 'excerpt',
'metadata', 'metadata',
'meta_title',
'meta_description',
'meta_keywords',
['slug', 'index' => true] ['slug', 'index' => true]
]; ];

View File

@ -1,58 +1,48 @@
# ===================================
# Field Definitions
# ===================================
fields: fields:
title: title:
label: rainlab.blog::lang.post.title label: 'rainlab.blog::lang.post.title'
span: left span: left
placeholder: rainlab.blog::lang.post.title_placeholder placeholder: 'rainlab.blog::lang.post.title_placeholder'
type: text
slug: slug:
label: rainlab.blog::lang.post.slug label: 'rainlab.blog::lang.post.slug'
span: right span: right
placeholder: rainlab.blog::lang.post.slug_placeholder placeholder: 'rainlab.blog::lang.post.slug_placeholder'
preset: preset:
field: title field: title
type: slug type: slug
type: text
toolbar: toolbar:
type: partial type: partial
path: post_toolbar path: post_toolbar
cssClass: collapse-visible cssClass: collapse-visible
secondaryTabs: secondaryTabs:
stretch: true
fields: fields:
content: content:
tab: rainlab.blog::lang.post.tab_edit tab: 'rainlab.blog::lang.post.tab_edit'
type: RainLab\Blog\FormWidgets\BlogMarkdown type: RainLab\Blog\FormWidgets\BlogMarkdown
cssClass: field-slim blog-post-preview cssClass: 'field-slim blog-post-preview'
stretch: true stretch: true
mode: split mode: split
categories: categories:
tab: rainlab.blog::lang.post.tab_categories tab: 'rainlab.blog::lang.post.tab_categories'
type: relation type: relation
commentAbove: rainlab.blog::lang.post.categories_comment commentAbove: 'rainlab.blog::lang.post.categories_comment'
placeholder: rainlab.blog::lang.post.categories_placeholder placeholder: 'rainlab.blog::lang.post.categories_placeholder'
published: published:
tab: rainlab.blog::lang.post.tab_manage tab: 'rainlab.blog::lang.post.tab_manage'
label: rainlab.blog::lang.post.published label: 'rainlab.blog::lang.post.published'
span: left span: left
type: checkbox type: checkbox
user: user:
tab: rainlab.blog::lang.post.tab_manage tab: 'rainlab.blog::lang.post.tab_manage'
label: rainlab.blog::lang.post.published_by label: 'rainlab.blog::lang.post.published_by'
span: right span: right
type: dropdown type: dropdown
emptyOption: rainlab.blog::lang.post.current_user emptyOption: 'rainlab.blog::lang.post.current_user'
published_at: published_at:
tab: rainlab.blog::lang.post.tab_manage tab: 'rainlab.blog::lang.post.tab_manage'
label: rainlab.blog::lang.post.published_on label: 'rainlab.blog::lang.post.published_on'
span: left span: left
cssClass: checkbox-align cssClass: checkbox-align
type: datepicker type: datepicker
@ -61,17 +51,32 @@ secondaryTabs:
action: enable action: enable
field: published field: published
condition: checked condition: checked
excerpt: excerpt:
tab: rainlab.blog::lang.post.tab_manage tab: 'rainlab.blog::lang.post.tab_manage'
label: rainlab.blog::lang.post.excerpt label: 'rainlab.blog::lang.post.excerpt'
type: textarea type: textarea
size: small size: small
featured_images: featured_images:
tab: rainlab.blog::lang.post.tab_manage tab: 'rainlab.blog::lang.post.tab_manage'
label: rainlab.blog::lang.post.featured_images label: 'rainlab.blog::lang.post.featured_images'
type: fileupload type: fileupload
mode: image mode: image
imageWidth: 200 imageWidth: 200
imageHeight: 200 imageHeight: 200
meta_title:
label: 'Meta title'
span: auto
type: text
tab: SEO
meta_description:
label: 'Meta Description'
size: large
span: left
type: textarea
tab: SEO
meta_keywords:
label: 'Meta keywords'
span: auto
size: large
type: textarea
tab: SEO

View File

@ -0,0 +1,27 @@
<?php namespace RainLab\Blog\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateRainlabBlogPosts2 extends Migration
{
public function up()
{
Schema::table('rainlab_blog_posts', function($table)
{
$table->string('meta_title')->nullable();
$table->text('meta_description')->nullable();
$table->text('meta_keywords')->nullable();
});
}
public function down()
{
Schema::table('rainlab_blog_posts', function($table)
{
$table->dropColumn('meta_title');
$table->dropColumn('meta_description');
$table->dropColumn('meta_keywords');
});
}
}

View File

@ -70,3 +70,6 @@
1.6.3: 1.6.3:
- 'Updated table rainlab_blog_posts' - 'Updated table rainlab_blog_posts'
- builder_table_update_rainlab_blog_posts.php - builder_table_update_rainlab_blog_posts.php
1.6.4:
- 'Updated table rainlab_blog_posts'
- builder_table_update_rainlab_blog_posts_2.php

View File

@ -17,6 +17,20 @@ class Content extends Model
protected $jsonable = ['data']; protected $jsonable = ['data'];
public $implement = ['@RainLab.Translate.Behaviors.TranslatableModel'];
public $translatable = [
'meta_title',
'meta_description',
'meta_keywords',
];
public $hasMany = [
'view' => [
'Tps\Pageview\Models\PageVisit',
'key' => 'page'
]
];
/** /**

View File

@ -74,6 +74,14 @@ tabs:
label: Text label: Text
span: full span: full
type: text type: text
type_info:
label: 'Type info'
span: auto
options:
phone: Phone
email: Email
default: phone
type: balloon-selector
col2: col2:
label: Col2 label: Col2
prompt: 'Add new item' prompt: 'Add new item'

View File

@ -45,3 +45,20 @@ tabs:
label: 'Is FLight' label: 'Is FLight'
span: auto span: auto
type: switch type: switch
meta_title:
label: 'Meta Title'
span: full
type: text
tab: SEO
meta_description:
label: 'Meta Description'
size: large
span: left
type: textarea
tab: SEO
meta_keywords:
label: 'Meta keywords'
size: large
span: right
type: textarea
tab: SEO

View File

@ -0,0 +1,27 @@
<?php namespace tps\Airport\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableUpdateTpsAirportContents2 extends Migration
{
public function up()
{
Schema::table('tps_airport_contents', function($table)
{
$table->string('meta_title')->nullable();
$table->text('meta_description')->nullable();
$table->text('meta_keywords')->nullable();
});
}
public function down()
{
Schema::table('tps_airport_contents', function($table)
{
$table->dropColumn('meta_title');
$table->dropColumn('meta_description');
$table->dropColumn('meta_keywords');
});
}
}

View File

@ -105,3 +105,6 @@
1.0.36: 1.0.36:
- 'Updated table tps_airport_page_content' - 'Updated table tps_airport_page_content'
- builder_table_update_tps_airport_page_content_2.php - builder_table_update_tps_airport_page_content_2.php
1.0.37:
- 'Updated table tps_airport_contents'
- builder_table_update_tps_airport_contents_2.php

View File

@ -0,0 +1,14 @@
<?php namespace Tps\Pageview;
use System\Classes\PluginBase;
class Plugin extends PluginBase
{
public function registerComponents()
{
}
public function registerSettings()
{
}
}

View File

@ -0,0 +1,18 @@
<?php namespace Tps\Pageview\Controllers;
use Backend\Classes\Controller;
use BackendMenu;
class PageVisit 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.Pageview', 'main-menu-item');
}
}

View File

@ -0,0 +1,18 @@
<div data-control="toolbar">
<a href="<?= Backend::url('tps/pageview/pagevisit/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>

View File

@ -0,0 +1,10 @@
name: PageVisit
form: $/tps/pageview/models/pagevisit/fields.yaml
modelClass: Tps\Pageview\Models\PageVisit
defaultRedirect: tps/pageview/pagevisit
create:
redirect: 'tps/pageview/pagevisit/update/:id'
redirectClose: tps/pageview/pagevisit
update:
redirect: tps/pageview/pagevisit
redirectClose: tps/pageview/pagevisit

View File

@ -0,0 +1,12 @@
list: $/tps/pageview/models/pagevisit/columns.yaml
modelClass: Tps\Pageview\Models\PageVisit
title: PageVisit
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/pageview/pagevisit/update/:id'

View File

@ -0,0 +1,46 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/pageview/pagevisit') ?>">PageVisit</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/pageview/pagevisit') ?>"><?= 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/pageview/pagevisit') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1 @@
<?= $this->listRender() ?>

View File

@ -0,0 +1,22 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/pageview/pagevisit') ?>">PageVisit</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/pageview/pagevisit') ?>" class="btn btn-default oc-icon-chevron-left">
<?= e(trans('backend::lang.form.return_to_list')) ?>
</a>
</p>

View File

@ -0,0 +1,54 @@
<?php Block::put('breadcrumb') ?>
<ul>
<li><a href="<?= Backend::url('tps/pageview/pagevisit') ?>">PageVisit</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/pageview/pagevisit') ?>"><?= 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/pageview/pagevisit') ?>" class="btn btn-default"><?= e(trans('backend::lang.form.return_to_list')) ?></a></p>
<?php endif ?>

View File

@ -0,0 +1,6 @@
<?php return [
'plugin' => [
'name' => 'PageView',
'description' => ''
]
];

View File

@ -0,0 +1,28 @@
<?php namespace Tps\Pageview\Models;
use Model;
/**
* Model
*/
class PageVisit extends Model
{
use \October\Rain\Database\Traits\Validation;
use \October\Rain\Database\Traits\SoftDelete;
protected $dates = ['deleted_at'];
protected $fillable = ['page','date'];
/**
* @var string The database table used by the model.
*/
public $table = 'tps_pageview_visit';
/**
* @var array Validation rules
*/
public $rules = [
];
}

View File

@ -0,0 +1,13 @@
columns:
id:
label: id
type: number
view:
label: view
type: text
date:
label: date
type: text
page:
label: page
type: text

View File

@ -0,0 +1,13 @@
fields:
view:
label: View
span: auto
type: number
date:
label: Date
span: auto
type: datepicker
page:
label: Page
span: auto
type: text

View File

@ -0,0 +1,11 @@
plugin:
name: 'tps.pageview::lang.plugin.name'
description: 'tps.pageview::lang.plugin.description'
author: tps
icon: oc-icon-eye
homepage: ''
navigation:
main-menu-item:
label: 'Page Visit'
url: tps/pageview/pagevisit
icon: icon-eye

View File

@ -0,0 +1,27 @@
<?php namespace Tps\Pageview\Updates;
use Schema;
use October\Rain\Database\Updates\Migration;
class BuilderTableCreateTpsPageviewVisit extends Migration
{
public function up()
{
Schema::create('tps_pageview_visit', 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->bigInteger('view')->default(0);
$table->date('date');
$table->string('page')->nullable();
});
}
public function down()
{
Schema::dropIfExists('tps_pageview_visit');
}
}

View File

@ -0,0 +1,5 @@
1.0.1:
- 'Initialize plugin.'
1.0.2:
- 'Created table tps_pageview_visit'
- builder_table_create_tps_pageview_visit.php

View File

@ -0,0 +1 @@
static-pages: { }

View File

@ -0,0 +1,10 @@
title = "privacy-policy"
url = "/privacy-policy"
is_hidden = 0
==
<article>
<div style='text-align:justify;'>
<h2 style='text-align:center;'>Политика конфиденциальности</h2>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nisi, voluptatibus, perferendis, nobis, magni id reiciendis laborum sunt quod quisquam impedit omnis aperiam hic sapiente eligendi inventore voluptatem corporis saepe suscipit officiis libero dolores possimus error tenetur u>
</div>
</article>