mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 17:26:43 +00:00
Update PublicApiController
This commit is contained in:
parent
cbb786f122
commit
9bbbd11160
1 changed files with 18 additions and 0 deletions
|
@ -19,6 +19,7 @@ use Carbon\Carbon;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
use App\Transformer\Api\{
|
use App\Transformer\Api\{
|
||||||
AccountTransformer,
|
AccountTransformer,
|
||||||
|
RelationshipTransformer,
|
||||||
StatusTransformer,
|
StatusTransformer,
|
||||||
};
|
};
|
||||||
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
use App\Jobs\StatusPipeline\NewStatusPipeline;
|
||||||
|
@ -330,4 +331,21 @@ class PublicApiController extends Controller
|
||||||
return response()->json($res);
|
return response()->json($res);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function relationships(Request $request)
|
||||||
|
{
|
||||||
|
abort_if(!Auth::check(), 403);
|
||||||
|
|
||||||
|
$this->validate($request, [
|
||||||
|
'id' => 'required|array|min:1|max:20'
|
||||||
|
]);
|
||||||
|
$ids = collect($request->input('id'));
|
||||||
|
$filtered = $ids->filter(function($v) {
|
||||||
|
return $v != Auth::user()->profile->id;
|
||||||
|
});
|
||||||
|
$relations = Profile::findOrFail($filtered->all());
|
||||||
|
$fractal = new Fractal\Resource\Collection($relations, new RelationshipTransformer());
|
||||||
|
$res = $this->fractal->createData($fractal)->toArray();
|
||||||
|
return response()->json($res);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue