ro
064407aa88
a class for members was needed for long term handling of member functions like login, update, status checking, etc so that class was created and the AuthService class was removed as it was redundant and it's functionaity moved to the member class
71 lines
2.1 KiB
PHP
71 lines
2.1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Interfaces\MemberRepositoryInterface;
|
|
use Illuminate\Http\Request;
|
|
|
|
class RouteController extends Controller
|
|
{
|
|
protected $dash;
|
|
protected $gate;
|
|
protected $theme;
|
|
protected $front;
|
|
protected $member;
|
|
|
|
public function __construct(
|
|
DashController $dashController,
|
|
AuthController $authController,
|
|
ThemeController $themeController,
|
|
FrontController $frontController,
|
|
MemberRepositoryInterface $memberRepo,
|
|
) {
|
|
$this->dash = $dashController;
|
|
$this->gate = $authController;
|
|
$this->theme = $themeController;
|
|
$this->front = $frontController;
|
|
$this->member = $memberRepo;
|
|
}
|
|
|
|
public function get($first = null, $second = null, $third = null, $fourth = null)
|
|
{
|
|
if (isset($first) && !is_numeric($first)) {
|
|
switch ($first) {
|
|
case 'dashboard':
|
|
if ($this->member::status()) {
|
|
return $this->dash->init($second, $third, $fourth);
|
|
} else {
|
|
return $this->dash->login();
|
|
}
|
|
break;
|
|
case 'theme':
|
|
if ($this->member::status()) {
|
|
if (isset($second)) {
|
|
return $this->theme->getView($third);
|
|
} else {
|
|
return $this->theme->start();
|
|
}
|
|
} else {
|
|
return $this->dash->login();
|
|
}
|
|
break;
|
|
case 'tags':
|
|
case 'archives':
|
|
return $this->front->page($first, $second, $third);
|
|
break;
|
|
}
|
|
} else {
|
|
return $this->front->index($first, $second, $third);
|
|
}
|
|
}
|
|
|
|
public function post(Request $request)
|
|
{
|
|
switch ($request->path()) {
|
|
case 'login':
|
|
return $this->gate->enter($request);
|
|
break;
|
|
}
|
|
}
|
|
}
|