getEloquent() public method

Get eloquent database instance
public getEloquent ( ) : Database
return Lassi\App\Database
示例#1
0
 /**
  * Set model(s) to use
  *
  * @param string|array $models
  *
  * @return $this
  */
 public function useModel($models)
 {
     if (is_array($models)) {
         return array_map(array($this, 'useModel'), $models);
     }
     if (is_scalar($models)) {
         $name = strtolower($models);
         $class = sprintf('\\Lassi\\Model\\%s', ucwords($name));
         $this->{$name} = new $class();
         $this->{$name}->setConnection($this->lassi->getEloquent());
     }
     return $this;
 }