Add a new menu entry

This is only a placeholder for now, it does not send to a real page yet.
This commit is contained in:
Antoine Le Gonidec 2024-07-16 16:54:04 +02:00
parent 1c456d4aca
commit 5beaf94f3a
Signed by: vv221
GPG key ID: 636B78F91CEB80D8
4 changed files with 55 additions and 1 deletions

View file

@ -0,0 +1,15 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace Modules\MMFCustomersGroups\Http\Controllers;
use Illuminate\Routing\Controller;
class CustomersGroupsController extends Controller {
public function list() {
// TODO
}
}

View file

@ -13,6 +13,6 @@ Route::group(
'namespace' => 'Modules\MMFCustomersGroups\Http\Controllers'
],
function() {
// TODO
Route::get('/groups/list', ['uses' => CustomersGroupsController::class . '@list', 'laroute' => true])->name('groups.list');
}
);

View file

@ -23,7 +23,9 @@ class MMFCustomersGroupsServiceProvider extends ServiceProvider {
*/
public function boot() {
$this->registerConfig();
$this->registerViews();
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->hooks();
}
/**
@ -48,4 +50,33 @@ class MMFCustomersGroupsServiceProvider extends ServiceProvider {
public function provides() {
return [];
}
/**
* Register views.
*
* @return void
*/
public function registerViews() {
$viewPath = resource_path('views/modules/mmfcustomersgroups');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath,
],'views');
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/mmfcustomersgroups';
}, \Config::get('view.paths')), [$sourcePath]), 'mmfcustomersgroups');
}
/**
* Module hooks.
*/
public function hooks() {
// Add a menu entry to manage the customer groups.
\Eventy::addAction('menu.manage.after_mailboxes', function() {
echo \View::make('mmfcustomersgroups::partials/menu', [])->render();
});
}
}

View file

@ -0,0 +1,8 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
?>
<li class=""><a href="{{ route('groups.list') }}">{{ __('Customers groups') }}</a></li>