freescout-customers-groups/Http/Controllers/CustomersGroupsController.php
Antoine Le Gonidec 7e749d7cf4
Add the ability to list existing Customers Groups
The ability to add new groups and update existing ones has not been implemented yet.
2024-07-16 17:16:41 +02:00

36 lines
816 B
PHP

<?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;
use Modules\MMFCustomersGroups\Entities\CustomersGroup;
class CustomersGroupsController extends Controller {
public function list() {
// Get the list of Mailboxes the current User is allowed to access.
$user = auth()->user();
$mailboxes = $user->mailboxesIdsCanView();
// Get the list of Customers Groups, filtered by Mailbox.
$groups = CustomersGroup
::whereIn('mailbox_id', $mailboxes)
->get();
return view('mmfcustomersgroups::groups/list', [
'groups' => $groups,
]);
}
public function create() {
// TODO
}
public function update() {
// TODO
}
}