Exemplo n.º 1
0
 public function expandReference($value, $request)
 {
     $referenceObject = Content::where('id', $value)->first();
     if ($referenceObject) {
         $referenceContentTypeDefinition = $this->getContentTypeDefinition($referenceObject['content_type']);
         $value = $this->convertFields($referenceObject, $referenceContentTypeDefinition, $request);
     } else {
         // If we can't find the reference object, there's no use of returning the id in the response so
         // let's just return a null.
         $value = null;
     }
     return $value;
 }
Exemplo n.º 2
0
 public function listContentJson($contentTypeSlug)
 {
     $lastModified = Content::where('content_type', $contentTypeSlug)->max('updated_at');
     $timestamp = Carbon::createFromFormat('Y-m-d H:i:s', $lastModified)->timestamp;
     $this->app->lastModified($timestamp);
     $content = Content::where('content_type', $contentTypeSlug)->where('is_published', true)->orderBy('created_at', 'desc')->get();
     $content = $this->app->contentService->convertFields($content);
     $this->app->contentType('application/json');
     $this->app->halt(200, $content->toJson(JSON_PRETTY_PRINT));
 }