如何使用Pingpong模块访问Laravel 5到特定模块

时间:2015-03-24 16:38:51

标签: php laravel laravel-5

我是Laravel 5和Pingpong-Modules https://github.com/pingpong-labs/modules

的新手

我想从模块目录的外部访问特定的模块功能。

我的实际配置是:

我想访问Method" test()"来自DashboardController - 这里最好的做法是什么?

控制器代码1:

<?php namespace App\Http\Controllers\Admin;

use App\Http\Controllers\AdminController;
use App\News;
use App\NewsCategory;
use App\User;
use App\Video;
use App\VideoAlbum;
use App\Photo;
use App\PhotoAlbum;

use \Pingpong\Modules\Facades\Module;
use App\Helpers\ModulesHelper;


class DashboardController extends AdminController {

    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
        $title = "Dashboard";

        $news = News::count();
        $newscategory = NewsCategory::count();
        $users = User::count();
        $photo = Photo::count();
        $photoalbum = PhotoAlbum::count();
        $video = Video::count();
        $videoalbum = VideoAlbum::count();


        return view('admin.dashboard.index',  compact('title','news','newscategory','video','videoalbum','photo',
            'photoalbum','users'));
    }

控制器代码2:

<?php namespace Modules\Users\Http\Controllers;

use Illuminate\Routing\Controller;
use Illuminate\Support\Facades\View;

class UsersController extends Controller {

    public function index()
    {
        return View::make('users::index');
    }

    public function test() {
        return "TEST";
    }

}

1 个答案:

答案 0 :(得分:0)

将此块放在DashboardController中的任何位置:

{{1}}