Test Failed
Push — master ( e3c39f...fe570d )
by Mihail
07:20
created

install_content_table-2016-12-04-15-32-44.php (1 issue)

1
<?php
2
3
use Ffcms\Core\Migrations\MigrationInterface;
4
use Ffcms\Core\Migrations\Migration;
5
6
/**
7
 * Class install_content_table.
8
 */
9
class install_content_table extends Migration implements MigrationInterface
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
{
11
    /**
12
     * Execute actions when migration is up
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        $this->getSchema()->create('contents', function($table) {
18
            $table->increments('id');
19
            $table->text('title');
20
            $table->mediumText('text');
21
            $table->string('path');
22
            $table->integer('category_id');
23
            $table->integer('author_id');
24
            $table->string('poster', 255)->nullable();
25
            $table->boolean('display')->default(true);
26
            $table->text('meta_title')->nullable();
27
            $table->text('meta_keywords')->nullable();
28
            $table->text('meta_description')->nullable();
29
            $table->integer('views')->default(0);
30
            $table->integer('rating')->default(0);
31
            $table->string('source', 1024)->nullable();
32
            $table->boolean('important')->default(false);
33
            $table->timestamps();
34
            $table->softDeletes();
35
        });
36
        parent::up();
37
    }
38
39
    /**
40
     * Seed created table via up() method with some data
41
     * @return void
42
     */
43
    public function seed()
44
    {
45
        // create content items
46
        $content = new stdClass();
47
        $content->item1 = [
48
            'title' => serialize(['en' => 'FFCMS 3 - the content management system', 'ru' => 'FFCMS 3 - система управления содержимым сайта']),
49
            'text' => serialize([
50
                'en' => '<p><strong>FFCMS 3</strong> - the new version of ffcms content management system, based on MVC application structure. FFCMS writed on php language syntax and using mysql, pgsql, sqlite or other PDO-compatable as database storage.</p><p>FFCMS is fully free system, distributed "as is" under MIT license and third-party packages license like GNU GPL v2/v3, BSD and other free-to-use license.</p><div style="page-break-after: always"><span style="display: none;"> </span></div><p>In basic distribution FFCMS included all necessary applications and widgets for classic website. The management interface of website is developed based on principles of maximum user friendly for fast usage. Moreover, the functional features of system can be faster and dynamicly extended by <strong>applications</strong> and <strong>widgets</strong>.</p><p>The FFCMS system can be used in any kind of website regardless of the model of monetization. Using FFCMS you can get the source code of system and change it or redistribute as you wish.</p><p>Official websites: <a href="http://ffcms.org">ffcms.org</a>, <a href="http://ffcms.ru">ffcms.ru</a></p>',
51
                'ru' => '<p><strong>FFCMS 3</strong> - новая версия системы управления содержимым сайта FFCMS, основанная на принципах построения приложений MVC. Система FFCMS написана с использованием синтаксиса языка php и использующая в качестве хранилища баз данных mysql, pgsql, sqlite или иную базу данных, совместимую с PDO драйвером.</p><p>FFCMS абсолютно бесплатная система, распространяемая по принципу "как есть (as is)" под лицензией MIT и лицензиями GNU GPL v2/v3, BSD и другими в зависимости от прочих используемых пакетов в составе системы.</p><div style="page-break-after: always"><span style="display: none;"> </span></div><p>В базовой поставке система имеет весь необходимый набор приложений и виджетов для реализации классического веб-сайта. Интерфейс управления содержимым сайта реализован исходя из принципов максимальной простоты использования. Кроме того, функциональные возможности системы могут быть быстро и динамично расширены при помощи <strong>приложений</strong> и <strong>виджетов</strong>.</p><p>Система FFCMS может быть использована на любых сайтах в не зависимости от моделей монетизации. Система имеет полностью открытый исходный код, который может быть вами использован как угодно.</p><p>Официальные сайты проекта: <a href="http://ffcms.org">ffcms.org</a>, <a href="http://ffcms.ru">ffcms.ru</a></p>'
52
            ]),
53
            'path' => 'ffcms3-announce',
54
            'category_id' => 2,
55
            'author_id' => 1,
56
            'display' => 1,
57
            'created_at' => $this->now,
58
            'updated_at' => $this->now
59
        ];
60
        $content->item2 = [
61
            'title' => serialize(['en' => 'About', 'ru' => 'О сайте']),
62
            'text' => serialize([
63
                'en' => '<p>This page can be edited in administrative panel > App > Content > "About".</p>',
64
                'ru' => '<p>Данная страница может быть отредактирована в административной панели > приложения > контент -> "О сайте".</p>'
65
            ]),
66
            'path' => 'about-page',
67
            'category_id' => 3,
68
            'author_id' => 1,
69
            'display' => 1,
70
            'created_at' => $this->now,
71
            'updated_at' => $this->now
72
        ];
73
74
        foreach ($content as $item) {
75
            $this->getConnection()->table('contents')->insert($item);
76
        }
77
    }
78
79
    /**
80
     * Execute actions when migration is down
81
     * @return void
82
     */
83
    public function down()
84
    {
85
        $this->getSchema()->dropIfExists('contents');
86
        parent::down();
87
    }
88
}