fixed default company identification
caused by https://github.com/laravel/framework/pull/42942
This commit is contained in:
parent
781711be53
commit
b3a10b554a
@ -65,7 +65,7 @@ abstract class Factory extends BaseFactory
|
||||
|
||||
$this->company->makeCurrent();
|
||||
|
||||
app('url')->defaults(['company_id' => $this->company->id]);
|
||||
//app('url')->defaults(['company_id' => $this->company->id]);
|
||||
}
|
||||
|
||||
public function getRawAttribute($key)
|
||||
|
@ -44,7 +44,7 @@ abstract class Notification extends BaseNotification implements ShouldQueue
|
||||
*/
|
||||
public function initMailMessage(): MailMessage
|
||||
{
|
||||
app('url')->defaults(['company_id' => company_id()]);
|
||||
//app('url')->defaults(['company_id' => company_id()]);
|
||||
|
||||
$message = (new MailMessage)
|
||||
->from(config('mail.from.address'), config('mail.from.name'))
|
||||
@ -64,7 +64,7 @@ abstract class Notification extends BaseNotification implements ShouldQueue
|
||||
*/
|
||||
public function initArrayMessage(): void
|
||||
{
|
||||
app('url')->defaults(['company_id' => company_id()]);
|
||||
//app('url')->defaults(['company_id' => company_id()]);
|
||||
}
|
||||
|
||||
public function getSubject(): string
|
||||
|
@ -26,9 +26,7 @@ class IdentifyCompany
|
||||
{
|
||||
$this->request = $request;
|
||||
|
||||
$company_id = $this->request->isApi()
|
||||
? $this->getCompanyIdFromApi()
|
||||
: $this->getCompanyIdFromWeb();
|
||||
$company_id = $this->getCompanyId();
|
||||
|
||||
if (empty($company_id)) {
|
||||
abort(500, 'Missing company');
|
||||
@ -60,6 +58,19 @@ class IdentifyCompany
|
||||
return $next($this->request);
|
||||
}
|
||||
|
||||
protected function getCompanyId()
|
||||
{
|
||||
if ($company_id = company_id()) {
|
||||
return $company_id;
|
||||
}
|
||||
|
||||
if ($this->request->isApi()) {
|
||||
return $this->getCompanyIdFromApi();
|
||||
}
|
||||
|
||||
return $this->getCompanyIdFromWeb();
|
||||
}
|
||||
|
||||
protected function getCompanyIdFromWeb()
|
||||
{
|
||||
return $this->getCompanyIdFromRoute() ?: ($this->getCompanyIdFromQuery() ?: $this->getCompanyIdFromHeader());
|
||||
|
2
composer.lock
generated
2
composer.lock
generated
@ -14115,5 +14115,5 @@
|
||||
"ext-zip": "*"
|
||||
},
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.3.0"
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user