"找不到页面" OctoberCMS的第一个插件

时间:2014-11-03 15:33:53

标签: php laravel octobercms

我正在处理插件的后端,我遇到了一些问题。我创建了所有插件所需的文件,模型,注册事物等等,但是每当我尝试访问后端URL时,例如http://alomicuba.dev/backend/alomicuba/balancerecharge我收到404错误,我不知道我做错了什么。这是/plugins/alomicuba/balancerecharge/controllers/balancerecharge/BalanceRecharge.php文件中的代码:

<?php namespace Alomicuba\BalanceRecharge\Controllers;

use Flash;
use BackendMenu;
use Backend\Classes\Controller;
use System\Classes\SettingsManager;
use Alomicuba\RechargeBalance\Models\Settings as BalanceRechargeSettings;

class BalanceRecharge extends Controller
{
    public $implement = [
        'Backend.Behaviors.FormController',
        'Backend.Behaviors.ListController'
    ];

    public $formConfig = 'config_form.yaml';
    public $listConfig = 'config_list.yaml';

    public $requiredPermissions = ['balancerecharge.*'];

    public $bodyClass = 'compact-container';

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

        BackendMenu::setContext('Alomicuba.BalanceRecharge', 'balancerecharge');
        SettingsManager::setContext('Alomicuba.BalanceRecharge', 'settings');
    }
}

这是Plugin.php代码:

class Plugin extends PluginBase {

    /**
     * Returns information about this plugin.
     *
     * @return array
     */
    public function pluginDetails()
    {
        return [
            'name' => 'Balance Recharge',
            'description' => 'Plugin that allows users to recharge theirs balance through the PayPal payment gateway',
            'author' => 'Dynamo Technology Solutions',
            'icon' => 'icon-credit-card'
        ];
    }

    public function registerNavigation()
    {
        return [
            'bradmin' => [
                'label'       => 'Balance Recharge',
                'url'         => Backend::url('alomicuba/balancerecharge/balancerecharge'),
                'icon'        => 'icon-credit-card',
                'permissions' => ['brecharge.*'],
                'order'       => 500,

                'sideMenu' => [
                    'brecharge' => [
                        'label'       => 'Balance Recharge',
                        'icon'        => 'icon-credit-card',
                        'url'         => Backend::url('alomicuba/balancerecharge/balancerecharge'),
                        'permissions' => ['brecharge.*'],
                    ],
                ]

            ]
        ];
    }

    public function registerSettings()
    {
        return [
            'settings' => [
                'label' => 'Balance Recharge PayPal Configuration',
                'description' => 'Manage the settings for Balance Recharge.',
                'category' => 'AloMiCuba',
                'icon' => 'icon-cog',
                'class' => 'Alomicuba\BalanceRecharge\Models\Settings',
                'order' => 100
            ]
        ];
    }

    public function boot()
    {
        \App::register('Barryvdh\Omnipay\ServiceProvider');
        \Illuminate\Foundation\AliasLoader::getInstance()->alias('Omnipay', 'Barryvdh\Omnipay\Facade');

        UserModel::extend(function($model){
            $model->hasMany['payment'] = ['Alomicuba\BalanceRecharge\Models\Payment'];
        });

    }

    public function registerComponents()
    {
        return [
            'Alomicuba\BalanceRecharge\Components\Payment' => 'Payment'
        ];
    }

}

我在这里遗漏了什么?

1 个答案:

答案 0 :(得分:2)

10月份控制器的CMS URL就像

 domain-name/backend/author-name/plugin-name/controller-name

所以在你的情况下你可以使用

 alomicuba.dev/backend/alomicuba/balancerecharge/balancerecharge