Domain detection failing for .co.uk, etc #647 (#648)

* Fix domain name detection #647

* Ignore page links check if no DB configured #641
This commit is contained in:
Nabeel S
2020-03-28 19:07:46 -04:00
committed by GitHub
parent 3e7d5f6195
commit 82b873c071
5 changed files with 169 additions and 19 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Http\Composers;
use App\Contracts\Composer;
use App\Repositories\PageRepository;
use Exception;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
@@ -26,13 +27,18 @@ class PageLinksComposer extends Composer
*/
public function compose(View $view)
{
// If not logged in, then only get the public pages
$w = ['enabled' => true];
if (!Auth::check()) {
$w = ['public' => true];
try {
// If not logged in, then only get the public pages
$w = ['enabled' => true];
if (!Auth::check()) {
$w = ['public' => true];
}
$pages = $this->pageRepo->findWhere($w, ['id', 'name', 'slug', 'icon']);
} catch (Exception $e) {
$pages = [];
}
$pages = $this->pageRepo->findWhere($w, ['id', 'name', 'slug', 'icon']);
$view->with('page_links', $pages);
}
}