2017-01-30 20:40:43 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Constants;
|
2017-01-12 14:12:02 +01:00
|
|
|
|
2018-03-29 10:11:00 +02:00
|
|
|
use App\Libraries\Utils;
|
|
|
|
|
2017-01-12 14:12:02 +01:00
|
|
|
class Domain
|
|
|
|
{
|
|
|
|
const INVOICENINJA_COM = 1;
|
|
|
|
const INVOICE_SERVICES = 2;
|
|
|
|
|
|
|
|
public static function getDomainFromId($id)
|
|
|
|
{
|
|
|
|
switch ($id) {
|
|
|
|
case static::INVOICENINJA_COM:
|
|
|
|
return 'invoiceninja.com';
|
|
|
|
case static::INVOICE_SERVICES:
|
|
|
|
return 'invoice.services';
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'invoiceninja.com';
|
|
|
|
}
|
|
|
|
|
|
|
|
public static function getLinkFromId($id)
|
|
|
|
{
|
|
|
|
return 'https://app.' . static::getDomainFromId($id);
|
|
|
|
}
|
2017-01-12 20:19:13 +01:00
|
|
|
|
|
|
|
public static function getEmailFromId($id)
|
|
|
|
{
|
|
|
|
return 'maildelivery@' . static::getDomainFromId($id);
|
|
|
|
}
|
2018-03-29 10:11:00 +02:00
|
|
|
|
|
|
|
public static function getCookieDomain($url)
|
|
|
|
{
|
|
|
|
if (! Utils::isNinjaProd() || Utils::isReseller()) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (strpos($url, '.services') !== false) {
|
|
|
|
return '.invoice.services';
|
|
|
|
} else {
|
|
|
|
return '.invoiceninja.com';
|
|
|
|
}
|
|
|
|
}
|
2017-01-12 14:12:02 +01:00
|
|
|
}
|