Files
muninn/app/Http/Controllers/Api/SocialAccountController.php
T
Doar MihaiandClaude Sonnet 5 5c24b6fbe0 feat: add read-only Social Accounts API
Add GET /api/accounts (list with optional ?network= and ?type= filters) and
GET /api/accounts/{socialAccount} (show) endpoints. Include plain-text password
field for AI agent consumption.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-18 15:25:56 +03:00

32 lines
783 B
PHP

<?php
namespace App\Http\Controllers\Api;
use App\Http\Controllers\Controller;
use App\Http\Resources\SocialAccountResource;
use App\Models\SocialAccount;
use Illuminate\Http\Request;
class SocialAccountController extends Controller
{
public function index(Request $request)
{
$query = SocialAccount::query();
if ($request->filled('network')) {
$query->where('network', $request->string('network'));
}
if ($request->filled('type')) {
$query->where('type', $request->string('type'));
}
return SocialAccountResource::collection($query->orderBy('username')->get());
}
public function show(SocialAccount $socialAccount)
{
return new SocialAccountResource($socialAccount);
}
}