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',
'host' => 'localhost',
'port' => 3306,
'database' => 'airport2023',
'database' => 'airport',
'username' => 'shohrat',
'password' => 'bt110226',
'password' => 'qazwsx12**',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',

View File

@ -69,7 +69,7 @@ class postController extends Controller
$dataVal = $request->all();
$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')
->find($id);

View File

@ -11,6 +11,8 @@ use Illuminate\Support\Facades\Validator;
use tps\Airport\Models\Content;
use tps\Airport\Models\Menu;
use Config;
use Tps\Pageview\Models\PageVisit as ViewModel;
use Carbon\Carbon;
class sectionController extends Controller
@ -31,9 +33,18 @@ class sectionController extends Controller
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)
{
$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();
@ -47,7 +58,7 @@ class sectionController extends Controller
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) {
@ -97,7 +108,8 @@ class sectionController extends Controller
$data[0]->section_contents = $contents;
$data->makeHidden(['data']);
$data[0]->visit = $this->visit(input('page'));
// dd($data[0]->data);
return $this->helpers->apiArrayResponseBuilder(200, 'success', $data);
} else {

View File

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

View File

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

@ -16,7 +16,21 @@ class Content extends Model
protected $dates = ['deleted_at'];
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
span: full
type: text
type_info:
label: 'Type info'
span: auto
options:
phone: Phone
email: Email
default: phone
type: balloon-selector
col2:
label: Col2
prompt: 'Add new item'

View File

@ -45,3 +45,20 @@ tabs:
label: 'Is FLight'
span: auto
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:
- 'Updated table tps_airport_page_content'
- 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>