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 { // @todo This should be a variable $uo = User::findOrFail(1); $so = ProviderOauth::where('name',$provider)->singleOrFail(); if (! ($to=$so->token($uo))) abort(500,sprintf('Unknown Tokens for [%s]',$uo->email)); $api = $to->API(); return $api->getItems() ->pluck('pid','Id') ->transform(function($item,$value) { return ['id'=>$value,'value'=>$item]; }) ->values(); } public function webhook(Request $request) { Log::channel('webhook')->debug('Webhook event',['request'=>$request]); } }