The first part of improving the API is removing all admin functions from the front end so those no admin methods will be available client side. The urls in the FipamoAdmin js file have been changed to post directly to the system and they are handled from there. To account for this change controller routes for every standard method have been created for better organization and readability. The FipamoAdmin js file will be integrated with the rest of the front end code and will not be seperate library
60 lines
1.9 KiB
PHP
60 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Interfaces\MemberRepositoryInterface;
|
|
|
|
class RouteGetController 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 handleRequest($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, $fourth);
|
|
} 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);
|
|
}
|
|
}
|
|
}
|