예제 #1
0
 public function setUp()
 {
     // TODO: need to figure out a way to remove this.
     Collection::from('auths');
     // only browser/server/device keys are affected by Role system.
     AppKey::current()->type = AppKey::TYPE_BROWSER;
     Context::setTrusted(false);
 }
예제 #2
0
 /**
  * Create a new CollectionDelegator instance.
  *
  * @param string                            $name
  * @param Illuminate\Database\Query\Builder $query  query
  */
 public function __construct($name)
 {
     // force plural collection names.
     $name = str_plural($name);
     $is_collection = !isset(static::$custom_collections[$name]);
     // protected collections
     if ($name == 'modules' || $name == '__sessions' || $name == 'auth_identities') {
         throw new UnauthorizedException();
     }
     if ($is_collection) {
         $query = Collection::from($name);
     } else {
         // FIXME:
         // workaround due wrong table_name reference.
         // similar problem on Hook\Database\Relationship#getRelationInstance
         $tmp_query = call_user_func(array(static::$custom_collections[$name], 'query'));
         $tmp_query->getModel()->setTable($name);
         $query = $tmp_query->getModel()->newQuery();
     }
     $this->name = $name;
     $this->is_collection = $is_collection;
     $this->query = $query;
 }
예제 #3
0
 /**
  * Create a new CollectionDelegator instance.
  *
  * @param string                            $name
  * @param Illuminate\Database\Query\Builder $query  query
  */
 public function __construct($name)
 {
     // force plural collection names.
     $name = str_plural($name);
     $is_collection = !isset(static::$custom_collections[$name]);
     // prevent access on private collections
     if (in_array($name, static::$private_collections)) {
         throw new ForbiddenException();
     }
     if ($is_collection) {
         $query = Collection::from($name);
     } else {
         // FIXME:
         // workaround due wrong table_name reference.
         // similar problem on Hook\Database\Relationship#getRelationInstance
         $tmp_query = call_user_func(array(static::$custom_collections[$name], 'query'));
         $tmp_query->getModel()->setTable($name);
         $query = $tmp_query->getModel()->newQuery();
     }
     $this->remember = null;
     $this->name = $name;
     $this->is_collection = $is_collection;
     $this->query = $query;
 }