예제 #1
1
 public function get()
 {
     $route = array('_links' => array("self" => array("href" => $this->rootUrl), "ea:login" => array('href' => $this->rootUrl . '/api/login'), "ea:user" => array('href' => $this->rootUrl . '/api/user/{id}'), "ea:student" => array('href' => $this->rootUrl . '/api/students')));
     $json = \q::z()->arrayToJSON($route);
     return Response::make($json, '200')->header('Content-Type', 'application/hal+json');
 }
예제 #2
0
 function get($module, $access = NULL)
 {
     $result = $this->context->apiRoute;
     if (empty($access)) {
         return $result[$module];
     } else {
         $resultEnum = \q::enum($result[$module]);
         return $resultEnum->where(function ($k) use($access) {
             return \q::enum($access)->contains($k['link']['rel']);
         })->val();
     }
 }
예제 #3
0
파일: noparam.php 프로젝트: devsnippet/SMA
<textarea rows="10" cols="50">
    <?php 
echo q::z()->arrayToSimpleXml(q::apiRoute()->get(''))->asXML();
?>
</textarea>
예제 #4
0
파일: models.php 프로젝트: jurica/salama
 public function findByName($name)
 {
     return User::where(q::username($name));
 }
예제 #5
0
파일: filtered.php 프로젝트: devsnippet/SMA
<textarea rows="10" cols="50">
    <?php 
echo q::z()->arrayToSimpleXml(q::apiRoute()->get('user', array('login')))->asXML();
?>
</textarea>
예제 #6
0
파일: 50.q.php 프로젝트: devsnippet/SMA
 public static function apiRoute()
 {
     return new \lib\ApiRoute(q::context());
 }
예제 #7
0
파일: QueryTest.php 프로젝트: jurica/salama
 public function relationMany()
 {
     $u = User::where(q::id(1));
     $this->assertEquals(SalamaSuite::$users[0], $u->username);
     $this->assertEquals($u->comments[0]->pub_date, 0);
     $this->assertEquals($u->comments[0]->user_id, $u->id);
     $this->assertEquals($u->username, $name);
     $this->assertEquals($u->comments[1]->pub_date, 1);
     $this->assertEquals($u->comments[1]->user_id, $u->id);
     foreach ($u->comments as $k => $v) {
         $this->assertEquals($v->pub_date, $k);
         $this->assertEquals($v->user_id, $u->id);
     }
     $this->assertEquals(count($u->comments), 2);
 }