Files
muninn/app/Http/Controllers/Api/SocialAccountController.php
T

32 lines
783 B
PHP
Raw Normal View History

2026-07-18 15:25:56 +03:00
<?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);
}
}