mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update ApiController
This commit is contained in:
parent
505b9ee732
commit
ec24dec2df
1 changed files with 25 additions and 2 deletions
|
@ -8,18 +8,32 @@ use Illuminate\Support\Str;
|
|||
use App\Jobs\StatusPipeline\StatusDelete;
|
||||
use Laravel\Passport\Passport;
|
||||
use Auth, Cache, DB;
|
||||
use Carbon\Carbon;
|
||||
use App\{
|
||||
Like,
|
||||
Media,
|
||||
Profile,
|
||||
Status
|
||||
};
|
||||
use League\Fractal;
|
||||
use App\Transformer\Api\{
|
||||
AccountTransformer,
|
||||
RelationshipTransformer,
|
||||
StatusTransformer,
|
||||
};
|
||||
use League\Fractal\Serializer\ArraySerializer;
|
||||
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
|
||||
|
||||
use App\Services\NotificationService;
|
||||
|
||||
class ApiV1Controller extends Controller {
|
||||
class ApiV1Controller extends Controller
|
||||
{
|
||||
protected $fractal;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->fractal = new Fractal\Manager();
|
||||
$this->fractal->setSerializer(new ArraySerializer());
|
||||
}
|
||||
public function apps(Request $request)
|
||||
{
|
||||
abort_if(!config('pixelfed.oauth_enabled'), 404);
|
||||
|
@ -54,4 +68,13 @@ class ApiV1Controller extends Controller {
|
|||
];
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function accountById(Request $request, $id)
|
||||
{
|
||||
$profile = Profile::whereNull('status')->findOrFail($id);
|
||||
$resource = new Fractal\Resource\Item($profile, new AccountTransformer());
|
||||
$res = $this->fractal->createData($resource)->toArray();
|
||||
|
||||
return response()->json($res);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue