diff --git a/Http/Controllers/CustomersGroupsController.php b/Http/Controllers/CustomersGroupsController.php index f0e06d6..d1a0e46 100644 --- a/Http/Controllers/CustomersGroupsController.php +++ b/Http/Controllers/CustomersGroupsController.php @@ -8,8 +8,29 @@ 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 } } diff --git a/Http/routes.php b/Http/routes.php index 2dc0795..6114f3b 100644 --- a/Http/routes.php +++ b/Http/routes.php @@ -14,5 +14,7 @@ Route::group( ], function() { Route::get('/groups/list', ['uses' => CustomersGroupsController::class . '@list', 'laroute' => true])->name('groups.list'); + Route::get('/groups/create', ['uses' => CustomersGroupsController::class . '@create', 'laroute' => true])->name('groups.create'); + Route::get('/groups/update', ['uses' => CustomersGroupsController::class . '@update', 'laroute' => true])->name('groups.update'); } ); diff --git a/Resources/views/groups/list.blade.php b/Resources/views/groups/list.blade.php new file mode 100644 index 0000000..79a3183 --- /dev/null +++ b/Resources/views/groups/list.blade.php @@ -0,0 +1,34 @@ + + */ +?> + +@extends('layouts.app') + +@section('title', __('Manage Customers Groups')) + +@section('content') +
+
+
+ {{ __('Customers Groups') }} +
+ +
+
+
+ @foreach ($groups as $group) + +

{{ $group->name }}

+
+ @endforeach +
+
+@endsection