Hello everyone,
I’m trying to create a very simple extension to add a new item to the admin sidebar, but I’m stuck on a “No page found” error and I’ve tried everything. I would really appreciate your help.
My goal is to add a menu item that links to a new blank page.
What I have done so far:
Created the extension files and folder structure.
Checked for case-sensitivity issues in folder names, filenames, and namespaces.
Cleared the cache multiple times using php artisan route:clear and php artisan cache:clear.
Edited the main composer.json file to add the extension to the autoload psr-4 section.
Successfully run composer dump-autoload via SSH.
Uninstalled and re-installed the extension from the admin panel multiple times after every change.
Despite all this, I still get the “No page found” error when I click the menu link.
Here is the complete code for my extension:
extensions/micompania/miboton/Extension.php
<?php
namespace Micompania\Miboton;
use System\Classes\BaseExtension;
class Extension extends BaseExtension
{
public function extensionMeta()
{
return [
'name' => 'Mi Botón Personalizado',
'author' => 'Ayrton',
'description' => 'Añade un botón y una página personalizada al panel de admin.',
'icon' => 'fa-puzzle-piece',
];
}
public function registerNavigation()
{
return [
'miboton' => [
'label' => 'Mi Menú Personalizado',
'icon' => 'fa fa-star',
'href' => admin_url('micompania/miboton'),
'permissions' => ['Admin.MiBoton'],
],
];
}
public function registerPermissions()
{
return [
'Admin.MiBoton' => [
'description' => 'Acceder a mi página personalizada',
'group' => 'module',
],
];
}
}
extensions/micompania/miboton/routes.php
<?php
use Illuminate\Support\Facades\Route;
Route::group([
'prefix' => 'micompania/miboton',
'middleware' => ['web', 'admin'],
], function () {
Route::get('/', 'Micompania\Miboton\Controllers\MibotonController@index');
});
extensions/micompania/miboton/controllers/MibotonController.php
<?php
namespace Micompania\Miboton\Controllers;
use Admin\Classes\AdminController;
class MibotonController extends AdminController
{
public function __construct()
{
parent::__construct();
$this->pageTitle = 'Mi Página Personalizada';
$this->pageTitleTemplate = '%s';
}
public function index()
{
return $this->makeView('micompania.miboton::miboton');
}
}
extensions/micompania/miboton/views/miboton/miboton.php
<div class="card">
<div class="card-header">
<h3>¡Mi nueva sección funciona!</h3>
</div>
<div class="card-body">
<p>Desde aquí puedo empezar a construir lo que necesite.</p>
</div>
</div>
I am using TastyIgniter on a Hostinger server. Can anyone see what I might be missing? Thank you very much for your time.