Honour site redirect and permenant if URI doesnt have it set.
This commit is contained in:
parent
7181c33a26
commit
94b50bea3e
@ -45,6 +45,7 @@ public function main()
|
||||
$u = SiteUri::where('site_id',$s->id)->firstOrNew(['uri'=>request()->getRequestUri()]);
|
||||
$u->hits++;
|
||||
$s->uris()->save($u);
|
||||
$u->refresh();
|
||||
|
||||
// If the site is not active, return
|
||||
if (! $s->getRawOriginal('active')) {
|
||||
|
@ -24,7 +24,7 @@ public function site()
|
||||
|
||||
public function getActiveAttribute(bool $value): bool
|
||||
{
|
||||
return $value && (strlen($this->redirect) > 0);
|
||||
return ($value && (strlen($this->redirect) > 0)) || $this->site->redirect;
|
||||
}
|
||||
|
||||
public function getDelayAttribute(int $value=NULL): int
|
||||
@ -37,6 +37,11 @@ public function getMessageAttribute(string $value=NULL): string
|
||||
return $this->active && $value ? $value : $this->site->message;
|
||||
}
|
||||
|
||||
public function getPermanentAttribute(bool $value): bool
|
||||
{
|
||||
return $value || $this->site->permanent;
|
||||
}
|
||||
|
||||
public function getRedirectAttribute(string $value=NULL): string
|
||||
{
|
||||
return ($x=($this->getRawOriginal('active') && $value ? $value : $this->site->redirect)) ? $x.(request()->getRequestUri() != '/' ? request()->getRequestUri() : '') : '';
|
||||
|
Loading…
Reference in New Issue
Block a user