Add tax_rates relation to company_user

This commit is contained in:
David Bomba 2020-11-27 08:05:30 +11:00
parent 1181f9de62
commit d07dedf264
6 changed files with 20 additions and 1 deletions

View File

@ -52,6 +52,7 @@ TRUSTED_PROXIES=
NINJA_ENVIRONMENT=selfhost NINJA_ENVIRONMENT=selfhost
PHANTOMJS_PDF_GENERATION=true
PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address' PHANTOMJS_KEY='a-demo-key-with-low-quota-per-ip-address'
PHANTOMJS_SECRET= PHANTOMJS_SECRET=

View File

@ -65,6 +65,7 @@ class BaseController extends Controller
'company.task_statuses', 'company.task_statuses',
'company.expense_categories', 'company.expense_categories',
'company.documents', 'company.documents',
'company.users',
//'company.users.company_user', //'company.users.company_user',
'company.clients.contacts.company', 'company.clients.contacts.company',
'company.clients.gateway_tokens', 'company.clients.gateway_tokens',

View File

@ -87,7 +87,7 @@ class CreateEntityPdf implements ShouldQueue
public function handle() public function handle()
{ {
if (config('ninja.phantomjs_key')) { if (config('ninja.phantomjs_pdf_generation')) {
return (new Phantom)->generate($this->invitation); return (new Phantom)->generate($this->invitation);
} }

View File

@ -11,6 +11,7 @@
namespace App\Models; namespace App\Models;
use App\Models\TaxRate;
use Illuminate\Database\Eloquent\Relations\Pivot; use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes; use Illuminate\Database\Eloquent\SoftDeletes;
@ -55,6 +56,11 @@ class CompanyUser extends Pivot
return self::class; return self::class;
} }
public function tax_rates()
{
return $this->hasMany(TaxRate::class,'company_id', 'company_id');
}
public function account() public function account()
{ {
return $this->belongsTo(Account::class); return $this->belongsTo(Account::class);

View File

@ -78,9 +78,19 @@ class SystemHealth
'simple_db_check' => (bool) self::simpleDbCheck(), 'simple_db_check' => (bool) self::simpleDbCheck(),
'npm_status' => self::checkNpm(), 'npm_status' => self::checkNpm(),
'node_status' => self::checkNode(), 'node_status' => self::checkNode(),
'cache_enabled' => self::checkConfigCache(),
'phantom_enabled' => (bool) config('ninja.phantomjs_pdf_generation'),
]; ];
} }
public static function checkConfigCache()
{
if(env('APP_URL'))
return false;
return true;
}
public static function checkNode() public static function checkNode()
{ {
try { try {

View File

@ -29,6 +29,7 @@ return [
'enabled_modules' => 32767, 'enabled_modules' => 32767,
'phantomjs_key' => env('PHANTOMJS_KEY', false), 'phantomjs_key' => env('PHANTOMJS_KEY', false),
'phantomjs_secret' => env('PHANTOMJS_SECRET', false), 'phantomjs_secret' => env('PHANTOMJS_SECRET', false),
'phantomjs_pdf_generation' => env('PHANTOMJS_PDF_GENERATION', true),
'trusted_proxies' => env('TRUSTED_PROXIES', false), 'trusted_proxies' => env('TRUSTED_PROXIES', false),
'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://9b4e15e575214354a7d666489783904a@sentry.invoicing.co/6'), 'sentry_dsn' => env('SENTRY_LARAVEL_DSN', 'https://9b4e15e575214354a7d666489783904a@sentry.invoicing.co/6'),