1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-28 23:40:41 +02:00

Flextype Box Plugin: Admin #125 #117

- admin route can be changed
This commit is contained in:
Awilum
2019-06-08 01:30:50 +03:00
parent 5e58d77cd7
commit 804ea59c97
2 changed files with 8 additions and 7 deletions

View File

@@ -17,9 +17,14 @@ use Flextype\Component\Arr\Arr;
use Flextype\Component\I18n\I18n;
use function Flextype\Component\I18n\__;
// Get URI
$uri = explode('/', \Slim\Http\Uri::createFromEnvironment(new \Slim\Http\Environment($_SERVER))->getPath());
if (isset($uri) && isset($uri[0]) && $uri[0] == 'admin') {
// Set base admin route
$admin_route = 'admin';
// Run Admin for admin_route
if (isset($uri) && isset($uri[0]) && $uri[0] == $admin_route) {
// Ensure vendor libraries exist
!is_file($autoload = __DIR__ . '/vendor/autoload.php') and exit("Please run: <i>composer install</i>");

View File

@@ -2,22 +2,18 @@
namespace Flextype;
// Set base admin route
$admin_route = '/admin';
// Site
$app->get('/', '')->setName('admin.site.index');
// UsersController
$app->group($admin_route, function () use ($flextype, $app) {
$app->group('/' . $admin_route, function () use ($flextype, $app) {
$app->get('/registration', 'UsersController:registration')->setName('admin.users.registration');
$app->post('/registration', 'UsersController:registrationProcess')->setName('admin.users.registrationProcess');
$app->get('/login', 'UsersController:login')->setName('admin.users.login');
$app->post('/login', 'UsersController:loginProcess')->setName('admin.users.loginProcess');
});
$app->group($admin_route, function () use ($flextype, $app) {
$app->group('/' . $admin_route, function () use ($flextype, $app) {
// UsersController
$app->get('/profile', 'UsersController:profile')->setName('admin.users.profile');