reynierpm
reynierpm

I'm working on the admin side for a plugin I'm working on but I'm having some issues and don't know how to fix them. See the admin class below (copied from RainLab.User plugin and adapted almost all to fit my needs):

<?php namespace Alomicuba\BalanceRecharge\Controllers;

use Flash;
use BackendMenu;
use BackendAuth;
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 = ['brecharge.*'];

    public $bodyClass = 'compact-container';

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

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

But when I try to access to the backend side I get this errors:

Class 'Alomicuba\BalanceRecharge\Backend' not found /var/www/html/alomicuba.dev/plugins/alomicuba/balancerecharge/Plugin.php line 31

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

                'sideMenu' => [
                    'brecharge' => [

What I'm doing wrong here? Any advice around this?

haeflimi
haeflimi

The Class that is mentioned in the Error. Did you really create a class lie this? Ohterwhise have you checkd your config_form.yaml and config_list.yaml for References to that class?

Anand Patel
Anand Patel

simply write following code

use Backend;

Last updated

auzadventure
auzadventure

Just remember to put a \ in front of global Classes

so backend is \backend

1-4 of 4