Example #1
0
 public function __construct($table = null)
 {
     //initiating R
     App::getInstance()->getContainer()->get('RedBean');
     if (!is_null($table)) {
         $this->_table = $table;
     } elseif (empty($this->_table)) {
         $class = get_called_class();
         $class = explode('\\', $class);
         $class = array_pop($class);
         $this->_table = strtolower(Inflect::pluralize($class));
     }
     $this->_bean = R::dispense($this->_table);
     if ($this->_timestamps) {
         $this->_bean->{'created_at'} = Carbon::now();
     }
 }
Example #2
0
/**
 * Get app instance
 * @return \ZigiPhp\App
 */
function app()
{
    return \ZigiPhp\App::getInstance();
}
Example #3
0
 public function dispatch()
 {
     $match = App::getInstance()->getContainer()->get('Router')->match();
     self::route($match);
 }