Add Direct Statics Controller

This commit is contained in:
David Bomba 2021-09-16 13:38:16 +10:00
parent e8147c9482
commit 0e33d3f03f
4 changed files with 41 additions and 3 deletions

View File

@ -0,0 +1,36 @@
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
namespace App\Http\Controllers;
use App\Http\Requests\Account\CreateAccountRequest;
use App\Jobs\Account\CreateAccount;
use App\Models\Account;
use App\Models\CompanyUser;
use App\Transformers\CompanyUserTransformer;
use App\Utils\Statics;
use Illuminate\Foundation\Bus\DispatchesJobs;
use Illuminate\Http\Response;
class StaticController extends BaseController
{
public function __invoke()
{
$response = Statics::company(auth()->user()->getCompany()->getLocale());
return response()->json($response, 200, ['Content-type'=> 'application/json; charset=utf-8'], JSON_PRETTY_PRINT);
}
}

View File

@ -116,9 +116,9 @@ class WebhookHandler implements ShouldQueue
]);
SystemLogger::dispatch(
$response,
array_merge((array)$response,$data),
SystemLog::CATEGORY_WEBHOOK,
SystemLog::EVENT_WEBHOOK_RESPONSE,
SystemLog::EVENT_WEBHOOK_SUCCESS,
SystemLog::TYPE_WEBHOOK_RESPONSE,
$this->company->clients->first(),
$this->company
@ -130,7 +130,7 @@ class WebhookHandler implements ShouldQueue
}
catch(\Exception $e){
nlog($e->getMessage());
nlog($e->getMessage());
SystemLogger::dispatch(
$e->getMessage(),

View File

@ -52,6 +52,7 @@ class SystemLog extends Model
const EVENT_MAIL_DELIVERY = 34;
const EVENT_WEBHOOK_RESPONSE = 40;
const EVENT_WEBHOOK_SUCCESS = 41;
const EVENT_PDF_RESPONSE = 50;
const EVENT_AUTHENTICATION_FAILURE = 60;

View File

@ -197,6 +197,7 @@ Route::group(['middleware' => ['api_db', 'token_auth', 'locale'], 'prefix' => 'a
Route::resource('subscriptions', 'SubscriptionController');
Route::post('subscriptions/bulk', 'SubscriptionController@bulk')->name('subscriptions.bulk');
Route::get('statics', 'StaticController');
});