diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 1b44804..3a7f63a 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -36,6 +36,7 @@ class Kernel extends HttpKernel \App\Http\Middleware\VerifyCsrfToken::class, \Illuminate\Routing\Middleware\SubstituteBindings::class, \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class, + \App\Http\Middleware\AddUserToView::class, ], 'api' => [ diff --git a/app/Http/Middleware/AddUserToView.php b/app/Http/Middleware/AddUserToView.php new file mode 100644 index 0000000..6df4069 --- /dev/null +++ b/app/Http/Middleware/AddUserToView.php @@ -0,0 +1,50 @@ +factory = $factory; + $this->user = $user; + } + + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $this->factory->share('user',$this->user); + + return $next($request); + } +} \ No newline at end of file diff --git a/resources/views/domain/view.blade.php b/resources/views/domain/view.blade.php index f55133f..edfe09b 100644 --- a/resources/views/domain/view.blade.php +++ b/resources/views/domain/view.blade.php @@ -150,7 +150,7 @@ @guest To start an application to join this network please login. @else - @if(Auth::user()->isMember($o)) + @if($user->isMember($o)) @else This website is not ready to take applications yet, check back soon! @endif diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index b4a83c5..c330db6 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -27,7 +27,7 @@
Expore Networks
@foreach (\App\Models\Domain::active() - ->when(! \Illuminate\Support\Facades\Auth::check(),function($query) { return $query->public(); }) + ->when((! $user),function($query) { return $query->public(); }) ->orderBy('name')->get() as $o)
{{ $o->name }}
@endforeach diff --git a/resources/views/layouts/partials/topmenu.blade.php b/resources/views/layouts/partials/topmenu.blade.php index dfeb503..c381a00 100644 --- a/resources/views/layouts/partials/topmenu.blade.php +++ b/resources/views/layouts/partials/topmenu.blade.php @@ -15,8 +15,8 @@