middleware('auth'); } /** * Query the accounting system and get a valid list of accounting codes * * @param string $provider * @return Collection */ public static function list(string $provider): Collection { $so = ProviderOauth::where('name',$provider)->singleOrFail(); // @todo This should be a variable $uo = User::findOrFail(1); if (($x=$so->tokens->where('user_id',$uo->id))->count() !== 1) abort(500,sprintf('Unknown Tokens for [%s]',$uo->email)); $to = $x->pop(); $api = $so->API($to,TRUE); // @todo Remove TRUE return $api->getItems() ->pluck('pid','FullyQualifiedName') ->transform(function($item,$value) { return ['id'=>$item,'value'=>$value]; }) ->values(); } public function webhook(Request $request) { Log::channel('webhook')->debug('Webhook event',['request'=>$request]); } }