public function index(Request $request, ApplicationContract $app) { $type = $request->query('type', 'all'); $user_id = $request->has('user_id') ? (int) $request->query('user_id') : $request->user('api')->id ?? 0; if (! in_array($type, ['all', 'adoption', 'invitation', 'other'])) { $type = 'all'; } return response()->json($app->call([$this, $type], ['user_id' => $user_id]), 200); }