Laravel中的管理面板? [英] Admin panel in Laravel?

查看:80
本文介绍了Laravel中的管理面板?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑从Code Igniter切换到Laravel.

I am looking at switching from Code Igniter to Laravel.

我们使用自定义管理面板部署了大量站点.

We deploy a large amount of sites, using our custom admin panel.

这是作为Code Igniter的两个安装而设置的,

This is setup as two installations of Code Igniter,

您基本上已经拥有(简化了,我们实际上在主站点和管理面板上都使用了HMVC,但这很重要)

You basically have (simplified, we actually use HMVC on both the main site and the admin panel, but this gets the point across)

index.php
assets
system
application
  config
  controllers
  models
  views    
admin
  index.php
  assets
  application 
    config 
    controllers
    models
    views     

然后将管理员安装设置为通过包含从主站点加载配置文件(例如database.php).

And the admin install is setup to load the config files (e.g. database.php) from the main site via includes.

我们用于主站点的所有模型都通过管理面板通过include使用模型,然后对其进行扩展,从而使我们能够仅具有主站点中特定于主站点的功能.

All our models for the main site use the models from the admin panel via include and then extend them, allowing us to have the functions that are specific to the main site in the main site only.

这对我们来说效果很好,但是现在我们切换到Laravel,我们想知道是否有更好的方法可以做到这一点,我们使用管理面板来管理多个模块",例如博客,购物车,物业经理,都是随手可得的.

This has worked quite well for us, but now we are switching to Laravel we are wondering if there is a better way of doing this, We use the admin panel to manage several "modules" such as a blog, shopping cart, property manager, which are all drop ins.

本质上,我们希望能够:

Essentially we want to be able to:

  • 清除主站点与管理面板之间的分隔,以便我们可以在任何站点上使用管理面板.
  • 仍然可以加入捆绑软件(例如博客捆绑软件).
  • 理想情况下,我们希望在管理面板和主站点之间有一个共享的bundles文件夹,其中包含三个文件夹. admin/main/shared,因此捆绑包是自包含的.
  • keep the separation of the main site from the admin panel clear so we can use the admin panel on any of our sites.
  • Be able to still drop in bundles (e.g. a blog bundle).
  • Idealistically we would like to have a shared bundles folder between the admin panel and the main site with three folders. admin/main/shared so a bundle is self contained.

在laravel中实现此最佳方法是什么?

What would the best way of implementing this be in laravel?

推荐答案

您可能已经在考虑这一点,但是考虑到捆绑包都是核心系统的一部分,因此我认为最好使用管理员捆绑包.对于SoC和简单性(易于使用)都有好处.

You may have already pondered this, but I think it would be best to use an admin bundle, considering that bundles are all part of the core system. It's good for SoC and for simplicity (ease of use).

然后,管理面板可以找到所有捆绑软件(当然,除了其本身之外),以读取和写入配置条目,例如博客捆绑软件的配置条目.

The admin panel could then find all bundles (except itself, of course) to read and write configuration entries, such as those of a blog bundle.

一种替代方法是通过将特定命令路由到各种管理控制器来将管理面板放置到您的主应用程序中(请记住,您可以将控制器放入子文件夹中).例如,您可以使用routes.phpadmin/pages/edit/152路由到application/controllers/admin/中的pages.php控制器.如前所述,您甚至可以使用这种方法通过扫描bundles目录来管理各种bundle/snap-ins.

An alternative would be to place the admin panel into your main application, by routing specific commands to various admin controllers (don't forget that you can put controllers into sub-folders). For example, you could route, using routes.php, admin/pages/edit/152 to the pages.php controller in application/controllers/admin/. You could even manage your various bundles/snap-ins using this approach, by means of scanning the bundles directory, as mentioned before.

这篇关于Laravel中的管理面板?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆