public function getSlimInstance()
 {
     $conf = (include __DIR__ . '/../etc/app-conf.php');
     return \AppFactory::create($conf);
 }
示例#2
0
<?php

date_default_timezone_set('Europe/Kiev');
require_once __DIR__ . '/../vendor/autoload.php';
$appConf = (require_once __DIR__ . '/../etc/app-conf.php');
Engine::init($appConf['dbConfig']['main']);
AppFactory::create($appConf)->add(new \Slim\Middleware\SessionCookie(['expires' => '1 day']));
AppFactory::$slimInstance->run();
示例#3
0
 public static function setUpBeforeClass()
 {
     if (!isset(self::$app)) {
         self::$app = AppFactory::create();
     }
     if (!Schema::hasTable('users')) {
         Schema::create('users', function ($table) {
             $table->increments('id');
             $table->string('name');
         });
     }
     DB::insert('insert into users (name) values (?)', array('Test User'));
     if (!Schema::hasTable('posts')) {
         Schema::create('posts', function ($table) {
             $table->increments('id');
             $table->string('title');
             $table->integer('created_by_id')->unsigned()->nullable();
             $table->integer('updated_by_id')->unsigned()->nullable();
             $table->integer('deleted_by_id')->unsigned()->nullable();
             $table->timestamps();
             $table->datetime('deleted_at')->nullable();
             $table->foreign('created_by_id')->references('id')->on('users');
             $table->foreign('updated_by_id')->references('id')->on('users');
             $table->foreign('deleted_by_id')->references('id')->on('users');
         });
     }
 }