public function getTable() { if (isset($this->table)) { return $this->table; } $ns = \O\c(\O\s(get_class($this)))->explode('\\'); if ($ns->slice(0, 3)->implode('\\') == 'RMAN\\Models\\ORM') { return snake_case(str_plural((string) $ns->slice(3)->implode('_'))); } }
use Illuminate\Database\MySqlConnection; use Illuminate\Events\Dispatcher as EventDispatcher; O\O::init(); date_default_timezone_set('America/Vancouver'); //////////////////////////////////////////////////////////////////////////////// // Load the Mustache Template engine and configure it // //////////////////////////////////////////////////////////////////////////////// $mustache = new Mustache_Engine(['loader' => new Mustache_Loader_FilesystemLoader(ROOTDIR . '/views/', ['extension' => '.ms']), 'partials_loader' => new Mustache_Loader_FilesystemLoader(ROOTDIR . '/views/', ['extension' => '.ms']), 'cache' => ROOTDIR . '/cache/mustache']); //////////////////////////////////////////////////////////////////////////////// // Load Laravel Database and ORM (Eloquent) // //////////////////////////////////////////////////////////////////////////////// require_once ROOTDIR . '/config/database.php'; $capsule = new Capsule(); $capsule->addConnection($DATABASE_CONFIG); $capsule->setEventDispatcher(new EventDispatcher()); $capsule->bootEloquent(); $capsule->setAsGlobal(); spl_autoload_register(function ($class) { $ns = O\c(O\s($class))->explode('\\'); if ($ns->count() <= 3) { return; } if ($ns->slice(0, 3)->implode('\\') == 'RMAN\\Models\\ORM') { $path = ROOTDIR . '/models/ORM/' . $ns->slice(3)->implode('/') . '.php'; if (file_exists($path)) { include $path; } } }); $container = new League\Di\Container(); require_once 'auth.php';
public function fulltitle() { return \O\c(\O\a($this->artists->toArray()))->map(function ($artist) { return $artist['name']; })->implode(' & ') . ' - ' . $this->title; }