previously all the of the page routing was handlede through controller organized by CRUD methods. it worked, but organizing by CRUD and not purpose resulted in more time spent looking for a specific task through controllers, so it turned out not to an effecient way of organizing. so routing has been completely reorganized into laravel's web routing section and methods have been moved to their appropriate controller so tasks are much easier to find front facing page routing turned out to be a bit more tricky that anticipated do the overap of routing paths, but it only affects dynamic page rendering and there's a patch in place that handles that issue until a better solution is found. Rendered HTML pages works fine. whew!
32 lines
709 B
PHP
32 lines
709 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Http\Request;
|
|
use App\Interfaces\MemberRepositoryInterface;
|
|
|
|
class MemberCheck
|
|
{
|
|
protected MemberRepositoryInterface $member;
|
|
|
|
public function __construct(
|
|
MemberRepositoryInterface $memberRepo,
|
|
) {
|
|
$this->member = $memberRepo;
|
|
}
|
|
|
|
/**
|
|
* Handle an incoming request.
|
|
*
|
|
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
|
|
*/
|
|
public function handle(Request $request, Closure $next)
|
|
{
|
|
if ($this->member::status()) {
|
|
return $next($request);
|
|
} else {
|
|
return redirect('dashboard');
|
|
}
|
|
}
|
|
}
|