Example #1
0
function database_start()
{
    $config = \App\Config::getInstance()->get('database');
    switch (strtolower($config['active'])) {
        case 'mysql':
            ORM::configure(sprintf('mysql:host=%s;dbname=%s', $config['mysql']['hostname'], $config['mysql']['name']));
            ORM::configure('username', $config['mysql']['username']);
            ORM::configure('password', $config['mysql']['password']);
    }
}
Example #2
0
<?php

use App\Models\User;
use App\Models\News;
use App\Config;
include 'autoload.php';
$articles = News::findAll();
include 'Assets/head.php';
$config = Config::getInstance();
var_dump($config);
/*
$news = new News();
$news->title = "Мой заголовок";
$news->text = "Мой текст";
$date = date("Y-m-d",strtotime($date));
$news->date = $date;
$news->save();
foreach ($articles as $news)
{
    echo "<table>";
    echo "<tr><td><a href='article.php?id=". $news->id ."'>";
    echo $news->title;
    echo "</a></td><tr>";
    echo "<tr><td>";
    echo $news->text;
    echo "</td><tr>";
    echo "</table>";
}
*/
include 'Assets/bottom.php';
Example #3
0
 /**
  * Gestion en appel statique
  *
  * @return Config
  */
 public static function __callStatic($method, $arguments)
 {
     $object = Config::getInstance();
     return call_user_func_array([$object, $method], $arguments);
 }