dougang1965 2016-12-09 14:58
浏览 38
已采纳

唯一路径请求需要多个控制器laravel


I am working on one laravel project. I am new to laravel. I have few roles(editor,user,admin) in the system. We don't need multi auth system. I don't need multi auth for different roles and create prefix based routes accordingly.
e.g

www.sitename.com/admin/editprofile, www.sitename.com/editor/editprofile 

Let's say if all above mentioned roles request for

www.sitename.com/editprofile

then I want to call individual controller based on role, so I can handle request properly and my code remain clean. I don't want to do all the things in single controller.

When user/role updates profile, different roles have different input fields so it's better to distribute request to individual controller.

Currently, I am using below package for roles and permission which is nice still. https://github.com/spatie/laravel-permission

Environments:

Laravel Version: 5.3
DATABASE: Mysql
Server: Apache

Please help me on this.

  • 写回答

1条回答 默认 最新

  • doupinyan0186 2016-12-09 23:16
    关注

    You should be able to 'listen' on 1 controller method and then redirect to others based on the input. At least with 5.3:

    https://laravel.com/docs/5.3/redirects#redirecting-controller-actions

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 PADS Logic 原理图
  • ¥15 PADS Logic 图标
  • ¥15 电脑和power bi环境都是英文如何将日期层次结构转换成英文
  • ¥20 气象站点数据求取中~
  • ¥15 如何获取APP内弹出的网址链接
  • ¥15 wifi 图标不见了 不知道怎么办 上不了网 变成小地球了
  • ¥50 STM32单片机传感器读取错误
  • ¥15 (关键词-阻抗匹配,HFSS,RFID标签天线)
  • ¥15 机器人轨迹规划相关问题
  • ¥15 word样式右侧翻页键消失