Example #1
0
<?php

Illuminate\Database\Capsule\Manager::schema($connectName)->create('roles', function ($table) {
    $table->increments('id');
    $table->string('name');
    $table->text('permissions');
    $table->timestamps();
});
$now = date('Y-m-d H:i:s', time());
Illuminate\Database\Capsule\Manager::connection($connectName)->table('roles')->insert([['name' => 'OnlyRead', 'permissions' => '', 'created_at' => $now, 'updated_at' => $now], ['name' => 'User', 'permissions' => 'global/write;global/file', 'created_at' => $now, 'updated_at' => $now], ['name' => 'Moderator', 'permissions' => 'global/write;global/modify;global/file', 'created_at' => $now, 'updated_at' => $now], ['name' => 'Admin', 'permissions' => 'global/all', 'created_at' => $now, 'updated_at' => $now]]);
Example #2
0
<?php

$now = date('Y-m-d H:i:s', time());
// create categories
$cat = new stdClass();
$cat->General = ['title' => serialize(['ru' => 'Главная', 'en' => 'General'])];
$cat->News = ['title' => serialize(['ru' => 'Новости', 'en' => 'News']), 'configs' => serialize(['showDate' => '1', 'showRating' => '1', 'showCategory' => '1', 'showAuthor' => '1', 'showViews' => '1', 'showComments' => '1', 'showPoster' => '1', 'showTags' => '1'])];
$cat->Page = ['title' => serialize(['ru' => 'Страницы', 'en' => 'Pages'])];
Illuminate\Database\Capsule\Manager::connection($connectName)->table('content_categories')->insert([['id' => 1, 'path' => '', 'title' => $cat->General['title'], 'description' => '', 'configs' => '', 'created_at' => $now, 'updated_at' => $now], ['id' => 2, 'path' => 'news', 'title' => $cat->News['title'], 'description' => '', 'configs' => $cat->News['configs'], 'created_at' => $now, 'updated_at' => $now], ['id' => 3, 'path' => 'page', 'title' => $cat->Page['title'], 'description' => '', 'configs' => '', 'created_at' => $now, 'updated_at' => $now]]);
// create content items
$content = new stdClass();
$content->item1 = ['title' => serialize(['en' => 'FFCMS 3 - the content management system', 'ru' => 'FFCMS 3 - система управления содержимым сайта']), 'text' => serialize(['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>', '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>']), 'path' => 'ffcms3-announce', 'category_id' => 2, 'author_id' => 1, 'display' => 1, 'comment_hash' => 'C89I9n3hhE4NAk0BoIG2eNDdhhc8CNigiL5GhG18Hjnlh672e77D7Laa8fG3cnl50imaC2OoKEACo6FD4nBpKnGDgE515lMeA8k', 'created_at' => $now, 'updated_at' => $now];
$content->item2 = ['title' => serialize(['en' => 'About', 'ru' => 'О сайте']), 'text' => serialize(['en' => '<p>This page can be edited in administrative panel > App > Content > "About".</p>', 'ru' => '<p>Данная страница может быть отредактирована в административной панели > приложения > контент -> "О сайте".</p>']), 'path' => 'about-page', 'category_id' => 3, 'author_id' => 1, 'display' => 1, 'comment_hash' => 'b4kAhho4b4KPlagam3A4B0E12BHCe092KjdFGD349hKcH9f67pi8p', 'created_at' => $now, 'updated_at' => $now];
foreach ($content as $item) {
    Illuminate\Database\Capsule\Manager::connection($connectName)->table('contents')->insert($item);
}
function edq()
{
    $log = Illuminate\Database\Capsule\Manager::connection()->getQueryLog();
    d($log);
}
Example #4
0
    $table->text('name');
    $table->binary('configs')->nullable();
    $table->boolean('disabled')->default(false);
    $table->string('version', 32)->default('1.0.0');
    // symantic version style
    $table->timestamps();
});
$now = date('Y-m-d H:i:s', time());
$configs = new stdClass();
$names = new stdClass();
$configs->user = serialize(['registrationType' => 1, 'captchaOnLogin' => 0, 'captchaOnRegister' => 1]);
$configs->profile = serialize(['guestView' => 1, 'wallPostOnPage' => 5, 'delayBetweenPost' => 30, 'rating' => 1, 'ratingDelay' => 60 * 60 * 24, 'usersOnPage' => 10]);
$configs->content = serialize(['itemPerCategory' => 10, 'userAdd' => 0, 'multiCategories' => 1, 'rss' => 1, 'gallerySize' => 500, 'galleryResize' => 250]);
$configs->feedback = serialize(['useCaptcha' => 1, 'guestAdd' => 1]);
$configs->comments = serialize(['perPage' => 10, 'delay' => 60, 'minLength' => 10, 'maxLength' => 5000, 'guestAdd' => 0, 'guestModerate' => 1, 'onlyLocale' => 0]);
$configs->newcontent = serialize(['categories' => ['2', '3'], 'count' => '5', 'cache' => '60']);
$configs->contenttag = serialize(['count' => 10, 'cache' => 120]);
$configs->newcomment = serialize(['snippet' => 50, 'count' => 5, 'cache' => 60]);
$configs->search = serialize(['itemPerApp' => 10, 'minLength' => 3]);
$names->user = serialize(['en' => 'User identity', 'ru' => 'Идентификация пользователя']);
$names->profile = serialize(['en' => 'User profiles', 'ru' => 'Профили пользователей']);
$names->content = serialize(['en' => 'Content', 'ru' => 'Контент']);
$names->feedback = serialize(['en' => 'Feedback', 'ru' => 'Обратная связь']);
$names->comments = serialize(['en' => 'Comments', 'ru' => 'Комментарии']);
$names->newcontent = serialize(['en' => 'New content', 'ru' => 'Новый контент']);
$names->contenttag = serialize(['en' => 'Content tags', 'ru' => 'Метки контента']);
$names->newcomment = serialize(['en' => 'New comments', 'ru' => 'Новые комментарии']);
$names->search = serialize(['en' => 'Search', 'ru' => 'Поиск']);
$names->sitemap = serialize(['en' => 'Sitemap', 'ru' => 'Карта сайта']);
Illuminate\Database\Capsule\Manager::connection($connectName)->table('apps')->insert([['type' => 'app', 'sys_name' => 'User', 'name' => $names->user, 'configs' => $configs->user, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'app', 'sys_name' => 'Profile', 'name' => $names->profile, 'configs' => $configs->profile, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'app', 'sys_name' => 'Content', 'name' => $names->content, 'configs' => $configs->content, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'app', 'sys_name' => 'Feedback', 'name' => $names->feedback, 'configs' => $configs->feedback, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'app', 'sys_name' => 'Search', 'name' => $names->search, 'configs' => $configs->search, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'app', 'sys_name' => 'Sitemap', 'name' => $names->sitemap, 'configs' => '', 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'widget', 'sys_name' => 'Comments', 'name' => $names->comments, 'configs' => $configs->comments, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'widget', 'sys_name' => 'Newcontent', 'name' => $names->newcontent, 'configs' => $configs->newcontent, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'widget', 'sys_name' => 'Contenttag', 'name' => $names->contenttag, 'configs' => $configs->contenttag, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now], ['type' => 'widget', 'sys_name' => 'Newcomment', 'name' => $names->newcomment, 'configs' => $configs->newcomment, 'version' => '1.0.0', 'created_at' => $now, 'updated_at' => $now]]);
Example #5
0
    DLModel::setEventDispatcher($event_dispatcher);
    $connection->setEventDispatcher($event_dispatcher);
} else {
    //
    // Create SQLite database
    //
    if ($db_config['driver'] == 'sqlite') {
        touch($db_config['database']);
    }
    $capsule = new Illuminate\Database\Capsule\Manager();
    $capsule->addConnection($db_config);
    $capsule->setFetchMode(PDO::FETCH_CLASS);
    $capsule->setEventDispatcher($event_dispatcher);
    $capsule->setAsGlobal();
    $capsule->bootEloquent();
    $connection = $capsule->connection();
    class_alias('\\Illuminate\\Database\\Eloquent\\Model', 'DLModel');
}
//
// Setup default date format
// Use a string representing an RFC2822 or ISO 8601 date
// http://tools.ietf.org/html/rfc2822#page-14
//
\Carbon\Carbon::setToStringFormat('Y-m-d\\TH:i:sP');
// Setup paginator
$connection->setPaginator(new Hook\Pagination\Environment());
// Setup Schema Grammar
// $connection->setSchemaGrammar();
// Setup cache manager
$connection->setCacheManager(function () {
    $cache_driver = Router::config('cache');