Tuning SQL queries

This commit is contained in:
David Bomba 2019-04-25 17:16:41 +10:00
parent 3baa48a23b
commit 6326a3c840
4 changed files with 11 additions and 2 deletions

View File

@ -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);
}
}

View File

@ -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);

View File

@ -44,6 +44,10 @@ class Company extends BaseModel
'settings' => 'object'
];
protected $with = [
// 'tokens'
];
public function getSettingsObjectAttribute()
{
return new CompanySettings($this->settings);

View File

@ -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;