Initial Commit
linter / quality (push) Canceled after 0s
tests / ci (8.3) (push) Canceled after 0s
tests / ci (8.4) (push) Canceled after 0s
tests / ci (8.5) (push) Canceled after 0s

This commit is contained in:
2026-08-28 21:50:26 +10:00
commit d8d4ecbe8a
142 changed files with 25234 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace App\Http\Controllers;
use App\Models\Post;
use Illuminate\Http\JsonResponse;
class PostController extends Controller
{
public function index(): JsonResponse
{
$posts = Post::orderByDesc('taken_at')
->limit(50)
->get()
->map(fn (Post $post) => [
'id' => $post->id,
'code' => $post->code,
'username' => $post->username,
'full_name' => $post->full_name,
'caption' => $post->caption,
'accessibility_caption' => $post->accessibility_caption,
'is_video' => $post->is_video,
'is_carousel' => $post->is_carousel,
'like_count' => $post->like_count,
'comment_count' => $post->comment_count,
'taken_at' => $post->taken_at,
'image_url' => $post->image_url,
'video_url' => $post->video_url,
'carousel_images' => $post->carousel_images,
'permalink' => $post->permalink,
'taken_at_date' => $post->taken_at_date->diffForHumans(),
'profile_pic_url' => $post->profile_pic_url,
]);
return response()->json($posts);
}
}