diff --git a/app/Http/Middleware/QueryLogging.php b/app/Http/Middleware/QueryLogging.php index 73fc3f1af3ae..b554d1dac037 100644 --- a/app/Http/Middleware/QueryLogging.php +++ b/app/Http/Middleware/QueryLogging.php @@ -39,7 +39,9 @@ class QueryLogging $timeEnd = microtime(true); $time = $timeEnd - $timeStart; Log::info($request->method() . ' - ' . $request->url() . ": $count queries - " . $time); - //Log::info($queries); + + if($count > 20) + Log::info($queries); } } diff --git a/app/Http/Middleware/TokenAuth.php b/app/Http/Middleware/TokenAuth.php index 9200771424c6..828818ac93bb 100644 --- a/app/Http/Middleware/TokenAuth.php +++ b/app/Http/Middleware/TokenAuth.php @@ -20,7 +20,6 @@ class TokenAuth if( $request->header('X-API-TOKEN') && ($user = CompanyToken::whereRaw("BINARY `token`= ?",[$request->header('X-API-TOKEN')])->first()->user ) ) { - //$user->with('company'); auth()->login($user); diff --git a/app/Models/Company.php b/app/Models/Company.php index cd5521134eab..3c99442c7bf9 100644 --- a/app/Models/Company.php +++ b/app/Models/Company.php @@ -44,6 +44,10 @@ class Company extends BaseModel 'settings' => 'object' ]; + protected $with = [ + // 'tokens' + ]; + public function getSettingsObjectAttribute() { return new CompanySettings($this->settings); diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 93295a1d7307..7ffe5acbcbcc 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -21,6 +21,10 @@ class Invoice extends BaseModel 'settings' => 'object' ]; + protected $with = [ + 'company' + ]; + const STATUS_DRAFT = 1; const STATUS_SENT = 2; const STATUS_PARTIAL = 5;