Compare commits

..

7 commits

28 changed files with 449 additions and 320 deletions

View file

@ -1,3 +1,8 @@
0.7.0
* Convert the PHP package into a Laravel module,
cf. https://laravelmodules.com/
0.6.1
* Fix the ability to rollback migrations.

5
Config/config.php Normal file
View file

@ -0,0 +1,5 @@
<?php
return [
'name' => 'MMFRestrictedCustomers'
];

View file

@ -4,10 +4,10 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Console\Commands;
namespace Modules\MMFRestrictedCustomers\Console\Commands;
use App\Conversation;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use Modules\MMFRestrictedCustomers\Entities\Customer;
use App\Events\CustomerCreatedConversation;
use App\Events\CustomerReplied;
use App\Thread;
@ -21,7 +21,7 @@ class FetchEmails extends BaseFetchEmails {
*
* @var string
*/
protected $signature = 'freescout-restricted-customers:fetch-emails {--days=3} {--unseen=1} {--identifier=dummy} {--mailboxes=0}';
protected $signature = 'mmfrestrictedcustomers:fetch-emails {--days=3} {--unseen=1} {--identifier=dummy} {--mailboxes=0}';
/**
* Save email from customer as thread.

View file

@ -7,8 +7,6 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Symfony\Component\Console\Output\ConsoleOutput;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
class DropEmailsOnCustomersDeletion extends Migration {
/**

View file

@ -8,7 +8,7 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Symfony\Component\Console\Output\ConsoleOutput;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use Modules\MMFRestrictedCustomers\Entities\Customer;
class AddMailboxIdColumnToCustomersTable extends Migration {
/**

View file

@ -0,0 +1,21 @@
<?php
namespace Modules\MMFRestrictedCustomers\Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;
class MMFRestrictedCustomersDatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Model::unguard();
// $this->call("OthersTableSeeder");
}
}

View file

@ -4,14 +4,8 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
namespace Modules\MMFRestrictedCustomers\Entities;
use App\CustomerChannel;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Storage;
use Watson\Rememberable\Rememberable;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Mailbox;
use App\Customer as BaseCustomer;
class Customer extends BaseCustomer {

View file

@ -4,10 +4,8 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
namespace Modules\MMFRestrictedCustomers\Entities;
use Illuminate\Database\Eloquent\Model;
use Watson\Rememberable\Rememberable;
use App\Email as BaseEmail;
class Email extends BaseEmail {

View file

@ -4,9 +4,8 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
namespace Modules\MMFRestrictedCustomers\Entities;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use App\Mailbox as BaseMailbox;
class Mailbox extends BaseMailbox {

View file

@ -4,13 +4,13 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers;
namespace Modules\MMFRestrictedCustomers\Http\Controllers;
use App\Conversation;
use App\User;
use Illuminate\Http\Request;
use App\Http\Controllers\ConversationsController as BaseConversationsController;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use Modules\MMFRestrictedCustomers\Entities\Customer;
class ConversationsController extends BaseConversationsController {
/**
@ -91,7 +91,7 @@ class ConversationsController extends BaseConversationsController {
$search_mailbox = $mailboxes[0];
}
return view('freescout-restricted-customers::conversations/search', [
return view('mmfrestrictedcustomers::conversations/search', [
'folder' => $folder,
'q' => $request->q,
'filters' => $filters,

View file

@ -4,7 +4,7 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers;
namespace Modules\MMFRestrictedCustomers\Http\Controllers;
use App\Conversation;
use Modules\Crm\Entities\CustomerField;
@ -14,9 +14,9 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Routing\Controller;
use Modules\Crm\Http\Controllers\CrmController as BaseCrmController;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Email;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Mailbox;
use Modules\MMFRestrictedCustomers\Entities\Customer;
use Modules\MMFRestrictedCustomers\Entities\Email;
use Modules\MMFRestrictedCustomers\Entities\Mailbox;
class CrmController extends BaseCrmController {
public function createCustomer(Request $request) {
@ -26,7 +26,7 @@ class CrmController extends BaseCrmController {
$user = auth()->user();
$mailboxes = $user->mailboxesCanView();
return view('freescout-restricted-customers::create_customer', [
return view('mmfrestrictedcustomers::create_customer', [
'customer' => $customer,
'mailboxes' => $mailboxes,
'emails' => [''],
@ -68,7 +68,7 @@ class CrmController extends BaseCrmController {
}
if ($fail || $validator->fails()) {
return redirect()->route('freescout-restricted-customers.create_customer')
return redirect()->route('mmfrestrictedcustomers.create_customer')
->withErrors($validator)
->withInput();
}

View file

@ -4,14 +4,14 @@
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers;
namespace Modules\MMFRestrictedCustomers\Http\Controllers;
use App\Conversation;
use App\Email;
use Illuminate\Http\Request;
use Validator;
use App\Http\Controllers\CustomersController as BaseCustomersController;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Customer;
use Modules\MMFRestrictedCustomers\Entities\Customer;
class CustomersController extends BaseCustomersController {
/**
@ -36,7 +36,7 @@ class CustomersController extends BaseCustomersController {
$emails = [''];
}
return view('freescout-restricted-customers::customers/update', [
return view('mmfrestrictedcustomers::customers/update', [
'customer' => $customer,
'mailboxes' => $mailboxes,
'emails' => $emails,
@ -382,11 +382,11 @@ class CustomersController extends BaseCustomersController {
// Conversations navigation
case 'customers_pagination':
$customers = app('MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController')->searchCustomers($request, $user);
$customers = app('Modules\MMFRestrictedCustomers\Http\Controllers\ConversationsController')->searchCustomers($request, $user);
$response['status'] = 'success';
$response['html'] = view('freescout-restricted-customers::customers/partials/customers_table', [
$response['html'] = view('mmfrestrictedcustomers::customers/partials/customers_table', [
'customers' => $customers,
])->render();
break;

30
Http/routes.php Normal file
View file

@ -0,0 +1,30 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
use Illuminate\Support\Facades\Route;
Route::group(['middleware' => 'web', 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\MMFRestrictedCustomers\Http\Controllers'], function() {
// Customers
Route::get('/customers/{id}/edit', CustomersController::class . '@update')->name('customers.update');
Route::post('/customers/{id}/edit', CustomersController::class . '@updateSave');
Route::get('/customers/{id}/', CustomersController::class . '@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => CustomersController::class . '@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => CustomersController::class . '@ajax', 'laroute' => true])->name('customers.ajax');
// Conversations
Route::get('/search', ConversationsController::class . '@search')->name('conversations.search');
// Crm module
Route::group([ 'roles' => ['user', 'admin'] ], function() {
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('mmfrestrictedcustomers.create_customer');
Route::post('/customers/new', CrmController::class . '@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => CrmController::class . '@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => CrmController::class . '@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => CrmController::class . '@ajax', 'laroute' => true])->name('crm.ajax');
});
Route::group([ 'roles' => ['admin'] ], function() {
Route::post('/customers/export', ['uses' => CrmController::class . '@export'])->name('crm.export');
Route::post('/crm/ajax-admin', ['uses' => CrmController::class . '@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
});
});

View file

@ -0,0 +1,109 @@
<?php
namespace Modules\MMFRestrictedCustomers\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Database\Eloquent\Factory;
use Modules\MMFRestrictedCustomers\Console\Commands\FetchEmails;
class MMFRestrictedCustomersServiceProvider extends ServiceProvider {
/**
* Indicates if loading of the provider is deferred.
*
* @var bool
*/
protected $defer = false;
/**
* Boot the application events.
*
* @return void
*/
public function boot() {
$this->registerConfig();
$this->registerViews();
$this->registerFactories();
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
$this->commands([
FetchEmails::class,
]);
$this->hooks();
}
/**
* Module hooks.
*/
public function hooks() {
//
}
/**
* Register the service provider.
*
* @return void
*/
public function register() {
$this->registerTranslations();
}
/**
* Register config.
*
* @return void
*/
protected function registerConfig() {
$this->publishes([
__DIR__.'/../Config/config.php' => config_path('mmfrestrictedcustomers.php'),
], 'config');
$this->mergeConfigFrom(
__DIR__.'/../Config/config.php', 'mmfrestrictedcustomers'
);
}
/**
* Register views.
*
* @return void
*/
public function registerViews() {
$viewPath = resource_path('views/modules/mmfrestrictedcustomers');
$sourcePath = __DIR__.'/../Resources/views';
$this->publishes([
$sourcePath => $viewPath
],'views');
$this->loadViewsFrom(array_merge(array_map(function ($path) {
return $path . '/modules/mmfrestrictedcustomers';
}, \Config::get('view.paths')), [$sourcePath]), 'mmfrestrictedcustomers');
}
/**
* Register translations.
*
* @return void
*/
public function registerTranslations() {
$this->loadJsonTranslationsFrom(__DIR__ .'/../Resources/lang');
}
/**
* Register an additional directory of factories.
* @source https://github.com/sebastiaanluca/laravel-resource-flow/blob/develop/src/Modules/ModuleServiceProvider.php#L66
*/
public function registerFactories() {
if (! app()->environment('production')) {
app(Factory::class)->load(__DIR__ . '/../Database/factories');
}
}
/**
* Get the services provided by the provider.
*
* @return array
*/
public function provides() {
return [];
}
}

2
Public/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
*
!/.gitignore

View file

@ -19,7 +19,7 @@ You have been warned.
### Install the package with composer
```
composer require "millions-missing-france/freescout-restricted-customers" "0.6.1"
composer require "millions-missing-france/mmfrestrictedcustomers" "0.7.0"
```
### Edit the application routes
@ -44,11 +44,11 @@ should be replaced with:
```php
// Customers
Route::get('/customers/{id}/edit', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@update')->name('customers.update');
Route::post('/customers/{id}/edit', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@updateSave');
Route::get('/customers/{id}/', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax');
Route::get('/customers/{id}/edit', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@update')->name('customers.update');
Route::post('/customers/{id}/edit', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@updateSave');
Route::get('/customers/{id}/', '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CustomersController@ajax', 'laroute' => true])->name('customers.ajax');
```
This other section should be edited too:
@ -78,7 +78,7 @@ Route::get('/mailbox/{mailbox_id}/new-ticket', 'ConversationsController@create')
Route::get('/mailbox/{mailbox_id}/clone-ticket/{from_thread_id}', 'ConversationsController@cloneConversation')->name('conversations.clone_conversation');
//Route::get('/conversation/draft/{id}', 'ConversationsController@draft')->name('conversations.draft');
Route::get('/conversation/ajax-html/{action}', ['uses' => 'ConversationsController@ajaxHtml', 'laroute' => true])->name('conversations.ajax_html');
Route::get('/search', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController@search')->name('conversations.search');
Route::get('/search', '\Modules\MMFRestrictedCustomers\Http\Controllers\ConversationsController@search')->name('conversations.search');
Route::get('/conversation/undo-reply/{thread_id}', 'ConversationsController@undoReply')->name('conversations.undo');
Route::get('/mailbox/{mailbox_id}/chats', 'ConversationsController@chats')->name('conversations.chats');
```
@ -107,19 +107,19 @@ Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'p
should be replaced with:
```php
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers'], function()
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['user', 'admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => 'Modules\MMFRestrictedCustomers\Http\Controllers'], function()
{
Route::get('/customers/new', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomer')->name('freescout-restricted-customers.create_customer');
Route::post('/customers/new', '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajax', 'laroute' => true])->name('crm.ajax');
Route::get('/customers/new', '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@createCustomer')->name('mmfrestrictedcustomers.create_customer');
Route::post('/customers/new', '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajax', 'laroute' => true])->name('crm.ajax');
});
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers'], function()
Route::group(['middleware' => ['web', 'auth', 'roles'], 'roles' => ['admin'], 'prefix' => \Helper::getSubdirectory(), 'namespace' => '\Modules\MMFRestrictedCustomers\Http\Controllers'], function()
{
Route::post('/customers/export', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@export'])->name('crm.export');
Route::post('/crm/ajax-admin', ['uses' => '\MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
Route::post('/customers/export', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@export'])->name('crm.export');
Route::post('/crm/ajax-admin', ['uses' => '\Modules\MMFRestrictedCustomers\Http\Controllers\CrmController@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
});
```
@ -134,7 +134,7 @@ At line 173, this route call:
should be replaced with:
```php
$html = __('Customers').' <a href="#" data-trigger="modal" data-modal-title="'.__('Add Customer').'" data-modal-size="lg" data-modal-no-footer="true" data-modal-body=\'<iframe src="'.route('freescout-restricted-customers.create_customer', ['x_embed' => 1]).'" frameborder="0" class="modal-iframe"></iframe>\' class="btn btn-bordered btn-xs" style="position:relative;top:-1px;margin-left:4px;"><i class="glyphicon glyphicon-plus" title="'.__('Add Customer').'" data-toggle="tooltip"></i></a>';
$html = __('Customers').' <a href="#" data-trigger="modal" data-modal-title="'.__('Add Customer').'" data-modal-size="lg" data-modal-no-footer="true" data-modal-body=\'<iframe src="'.route('mmfrestrictedcustomers.create_customer', ['x_embed' => 1]).'" frameborder="0" class="modal-iframe"></iframe>\' class="btn btn-bordered btn-xs" style="position:relative;top:-1px;margin-left:4px;"><i class="glyphicon glyphicon-plus" title="'.__('Add Customer').'" data-toggle="tooltip"></i></a>';
```
### Edit the artisan commands
@ -151,8 +151,8 @@ At the lines 107-108, this:
should be replaced with:
```php
$fetch_command_identifier = \Helper::getWorkerIdentifier('freescout-restricted-customers:fetch-emails');
$fetch_command_name = 'freescout-restricted-customers:fetch-emails'
$fetch_command_identifier = \Helper::getWorkerIdentifier('mmfrestrictedcustomers:fetch-emails');
$fetch_command_name = 'mmfrestrictedcustomers:fetch-emails'
```
### Update the database schema

View file

@ -0,0 +1,175 @@
@extends('layouts.app')
@section('title', ($q ? $q.' - ' : '').strip_tags(Eventy::filter('search.title', __('Search'))))
@section('body_class', 'body-search')
@section('sidebar')
@include('partials/sidebar_menu_toggle')
<div class="sidebar-title">
{!! Eventy::filter('search.title', __('Search')) !!}
</div>
<ul class="sidebar-menu sidebar-menu-noicons">
@if (!$recent || (count($recent) == 1 && $recent[0] == $q))
@else
<li class="no-link"><span class="text-help">{{ __('Recent') }}</span></li>
@foreach ($recent as $recent_query)
@if ($recent_query != $q)
<li class="menu-link menu-padded"><a href="{{ route('conversations.search', ['q' => $recent_query, 'mode' => $mode])}}">{{ $recent_query }}</a></li>
@endif
@endforeach
@endif
<li class="no-link"><span class="text-help">{{ __('Filters') }}</span></li>
@foreach ($filters_list as $filter)
<li class="menu-link menu-padded">
<a href="#" data-filter="{{ $filter }}" @if (isset($filters[$filter]))class="active"@endif>{{ mb_strtolower(__(ucwords($filter))) }}:</a>
</li>
@endforeach
</ul>
@endsection
@section('content')
<div class="section-heading section-search">
<form action="{{ route('conversations.search') }}">
@if (request()->x_embed)
<input type="hidden" name="x_embed" value="{{ request()->x_embed }}" />
@endif
@if (!empty($filters['custom']))
<input type="hidden" name="f[custom]" value="{{ $filters['custom'] }}" />
@endif
@if ($mode != App\Conversation::SEARCH_MODE_CONV)
<input type="hidden" name="mode" value="{{ $mode }}" />
@endif
<div class="row" id="search-filters">
<div class="col-sm-6 form-group @if (isset($filters['assigned'])) active @endif" data-filter="assigned">
<label>{{ __('Assigned') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[assigned]" class="form-control" @if (empty($filters['assigned'])) disabled @endif>
<option value=""></option>
<option value="{{ App\Conversation::USER_UNASSIGNED }}" @if (!empty($filters['assigned']) && $filters['assigned'] == App\Conversation::USER_UNASSIGNED)selected="selected"@endif>{{ __('Unassigned') }}</option>
@foreach ($users as $user)
<option value="{{ $user->id }}" @if (!empty($filters['assigned']) && $filters['assigned'] == $user->id)selected="selected"@endif>{{ $user->getFullName() }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['customer'])) active @endif" data-filter="customer">
<label>{{ __('Customer') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<div class="controls">
<select class="form-control" name="f[customer]" id="search-filter-customer" @if (empty($filters['customer'])) disabled @endif/>
@if (!empty($filters['customer']) && !empty($filters_data['customer']))
<option value="{{ $filters_data['customer']->id }}" selected="selected">{{ $filters_data['customer']->getEmailAndName() }}</option>
@endif
</select>
</div>
</div>
<div class="col-sm-6 form-group @if (isset($filters['mailbox'])) active @endif" data-filter="mailbox">
<label>{{ __('Mailbox') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[mailbox]" class="form-control" @if (empty($filters['mailbox'])) disabled @endif>
<option value=""></option>
@foreach ($mailboxes as $mailbox_item)
<option value="{{ $mailbox_item->id }}" @if (!empty($filters['mailbox']) && $filters['mailbox'] == $mailbox_item->id)selected="selected"@endif>{{ $mailbox_item->name }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['status'])) active @endif" data-filter="status">
<label>{{ __('Status') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[status][]" class="form-control filter-multiple" multiple @if (empty($filters['status'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$statuses as $status_id => $dummy)
<option value="{{ $status_id }}" @if (!empty($filters['status']) && in_array($status_id, $filters['status']))selected="selected"@endif>{{ App\Conversation::statusCodeToName($status_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['state'])) active @endif" data-filter="state">
<label>{{ __('State') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[state][]" class="form-control filter-multiple" multiple @if (empty($filters['state'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$states as $state_id => $dummy)
<option value="{{ $state_id }}" @if (!empty($filters['state']) && in_array($state_id, $filters['state']))selected="selected"@endif>{{ App\Conversation::stateCodeToName($state_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['subject'])) active @endif" data-filter="subject">
<label>{{ __('Subject') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[subject]" value="{{ $filters['subject'] ?? ''}}" class="form-control" @if (empty($filters['subject'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['attachments'])) active @endif" data-filter="attachments">
<label>{{ __('Attachments') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[attachments]" class="form-control" @if (empty($filters['attachments'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['attachments']) && $filters['attachments'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
<option value="no" @if (!empty($filters['attachments']) && $filters['attachments'] == 'no')selected="selected"@endif>{{ __('No') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['type'])) active @endif" data-filter="type">
<label>{{ __('Type') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[type]" class="form-control" @if (empty($filters['type'])) disabled @endif>
<option value=""></option>
@foreach (App\Conversation::$types as $type_id => $dummy)
<option value="{{ $type_id }}" @if (!empty($filters['type']) && $filters['type'] == $type_id)selected="selected"@endif>{{ App\Conversation::typeToName($type_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['body'])) active @endif" data-filter="body">
<label>{{ __('Body') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[body]" value="{{ $filters['body'] ?? ''}}" class="form-control" @if (empty($filters['body'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['number'])) active @endif" data-filter="number">
<label>{{ __('Number') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[number]" value="{{ $filters['number'] ?? ''}}" class="form-control" @if (empty($filters['number'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['following'])) active @endif" data-filter="following">
<label>{{ __('Following') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[following]" class="form-control" @if (empty($filters['following'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['following']) && $filters['following'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['id'])) active @endif" data-filter="id">
<label>{{ __('ID') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[id]" value="{{ $filters['id'] ?? ''}}" class="form-control" @if (empty($filters['id'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['after'])) active @endif" data-filter="after">
<label>{{ __('After') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[after]" value="{{ $filters['after'] ?? ''}}" class="form-control input-date" @if (empty($filters['after'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['before'])) active @endif" data-filter="before">
<label>{{ __('Before') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[before]" value="{{ $filters['before'] ?? ''}}" class="form-control input-date" @if (empty($filters['before'])) disabled @endif>
</div>
@action('search.display_filters', $filters, $filters_data, $mode)
</div>
<div class="input-group input-group-lg1">
<input type="text" class="form-control" name="q" value="{{ $q }}">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">{{ __('Search') }}</button>
</span>
</div>
</form>
</div>
<div class="search-results">
<ul class="nav nav-tabs nav-tabs-main margin-top">
@if (Eventy::filter('search.is_tab_visible', true, App\Conversation::SEARCH_MODE_CONV))
<li @if ($mode == App\Conversation::SEARCH_MODE_CONV)class="active search-tab-conv"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CONV])) }}">{{ __('Conversations') }} <b>({{ $conversations->total() }})</b>@action('search.conversations_tab_append', $filters, $conversations->total())</a></li>
@endif
<li @if ($mode == App\Conversation::SEARCH_MODE_CUSTOMERS)class="active"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CUSTOMERS])) }}">{{ __('Customers') }} <b>({{ $customers->total() }})</b></a></li>
</ul>
@if ($mode == App\Conversation::SEARCH_MODE_CONV)
@include('conversations/conversations_table', ['mailbox' => $search_mailbox, 'params' => ['target_blank' => true, 'show_mailbox' => (count(Auth::user()->mailboxesCanView(true)) > 1)]])
@else
@include('mmfrestrictedcustomers::customers/partials/customers_table')
@endif
</div>
@endsection
@include('partials/include_datepicker')
@section('javascript')
@parent
searchInit();
@endsection

View file

@ -3,7 +3,7 @@
@section('title', 'Add Customer (MillionsMissingFrance)')
@section('content')
@include('freescout-restricted-customers::customers/partials/edit_form', ['save_button_title' => __('Add')])
@include('mmfrestrictedcustomers::customers/partials/edit_form', ['save_button_title' => __('Add')])
@endsection
@section('javascript')

View file

@ -6,18 +6,18 @@
@section('body_attrs')@parent data-customer_id="{{ $customer->id }}"@endsection
@section('sidebar')
<div class="profile-preview">
@include('customers/profile_menu')
@include('customers/profile_snippet')
</div>
<div class="profile-preview">
@include('customers/profile_menu')
@include('customers/profile_snippet')
</div>
@endsection
@section('content')
@include('customers/profile_tabs')
@include('freescout-restricted-customers::customers/partials/edit_form')
@include('customers/profile_tabs')
@include('mmfrestrictedcustomers::customers/partials/edit_form')
@endsection
@section('javascript')
@parent
multiInputInit();
@parent
multiInputInit();
@endsection

View file

@ -1,7 +1,7 @@
{
"name": "millions-missing-france/freescout-restricted-customers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "0.6.1",
"version": "0.7.0",
"type": "library",
"license": ["AGPL-3.0-only"],
"authors": [
@ -10,19 +10,19 @@
"email": "info@millionsmissing.fr"
}
],
"require": {
"laravel/framework": "v5.5.40"
},
"autoload": {
"psr-4": {
"MillionsMissingFrance\\FreescoutRestrictedCustomers\\": "src"
}
},
"extra": {
"laravel": {
"providers": [
"MillionsMissingFrance\\FreescoutRestrictedCustomers\\FreescoutRestrictedCustomersServiceProvider"
]
"Modules\\MMFRestrictedCustomers\\Providers\\MMFRestrictedCustomersServiceProvider"
],
"aliases": {
}
}
},
"autoload": {
"psr-4": {
"Modules\\MMFRestrictedCustomers\\": ""
}
}
}

25
module.json Normal file
View file

@ -0,0 +1,25 @@
{
"name": "MMFRestrictedCustomers",
"alias": "mmfrestrictedcustomers",
"description": "Freescout restricted customers - Restrict access to Freescout customers to specific mailboxes",
"version": "0.7.0",
"detailsUrl": "",
"author": "Millions Missing FRANCE",
"authorUrl": "info@millionsmissing.fr",
"requiredAppVersion": "1.8.117",
"license": "AGPL-3.0-only",
"keywords": [],
"active": 0,
"order": 0,
"providers": [
"Modules\\MMFRestrictedCustomers\\Providers\\MMFRestrictedCustomersServiceProvider"
],
"aliases": {},
"files": [
"start.php"
],
"requires": [],
"requiredModules": {
"crm": "1.0.46"
}
}

View file

@ -1,175 +0,0 @@
@extends('layouts.app')
@section('title', ($q ? $q.' - ' : '').strip_tags(Eventy::filter('search.title', __('Search'))))
@section('body_class', 'body-search')
@section('sidebar')
@include('partials/sidebar_menu_toggle')
<div class="sidebar-title">
{!! Eventy::filter('search.title', __('Search')) !!}
</div>
<ul class="sidebar-menu sidebar-menu-noicons">
@if (!$recent || (count($recent) == 1 && $recent[0] == $q))
@else
<li class="no-link"><span class="text-help">{{ __('Recent') }}</span></li>
@foreach ($recent as $recent_query)
@if ($recent_query != $q)
<li class="menu-link menu-padded"><a href="{{ route('conversations.search', ['q' => $recent_query, 'mode' => $mode])}}">{{ $recent_query }}</a></li>
@endif
@endforeach
@endif
<li class="no-link"><span class="text-help">{{ __('Filters') }}</span></li>
@foreach ($filters_list as $filter)
<li class="menu-link menu-padded">
<a href="#" data-filter="{{ $filter }}" @if (isset($filters[$filter]))class="active"@endif>{{ mb_strtolower(__(ucwords($filter))) }}:</a>
</li>
@endforeach
</ul>
@endsection
@section('content')
<div class="section-heading section-search">
<form action="{{ route('conversations.search') }}">
@if (request()->x_embed)
<input type="hidden" name="x_embed" value="{{ request()->x_embed }}" />
@endif
@if (!empty($filters['custom']))
<input type="hidden" name="f[custom]" value="{{ $filters['custom'] }}" />
@endif
@if ($mode != App\Conversation::SEARCH_MODE_CONV)
<input type="hidden" name="mode" value="{{ $mode }}" />
@endif
<div class="row" id="search-filters">
<div class="col-sm-6 form-group @if (isset($filters['assigned'])) active @endif" data-filter="assigned">
<label>{{ __('Assigned') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[assigned]" class="form-control" @if (empty($filters['assigned'])) disabled @endif>
<option value=""></option>
<option value="{{ App\Conversation::USER_UNASSIGNED }}" @if (!empty($filters['assigned']) && $filters['assigned'] == App\Conversation::USER_UNASSIGNED)selected="selected"@endif>{{ __('Unassigned') }}</option>
@foreach ($users as $user)
<option value="{{ $user->id }}" @if (!empty($filters['assigned']) && $filters['assigned'] == $user->id)selected="selected"@endif>{{ $user->getFullName() }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['customer'])) active @endif" data-filter="customer">
<label>{{ __('Customer') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<div class="controls">
<select class="form-control" name="f[customer]" id="search-filter-customer" @if (empty($filters['customer'])) disabled @endif/>
@if (!empty($filters['customer']) && !empty($filters_data['customer']))
<option value="{{ $filters_data['customer']->id }}" selected="selected">{{ $filters_data['customer']->getEmailAndName() }}</option>
@endif
</select>
</div>
</div>
<div class="col-sm-6 form-group @if (isset($filters['mailbox'])) active @endif" data-filter="mailbox">
<label>{{ __('Mailbox') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[mailbox]" class="form-control" @if (empty($filters['mailbox'])) disabled @endif>
<option value=""></option>
@foreach ($mailboxes as $mailbox_item)
<option value="{{ $mailbox_item->id }}" @if (!empty($filters['mailbox']) && $filters['mailbox'] == $mailbox_item->id)selected="selected"@endif>{{ $mailbox_item->name }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['status'])) active @endif" data-filter="status">
<label>{{ __('Status') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[status][]" class="form-control filter-multiple" multiple @if (empty($filters['status'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$statuses as $status_id => $dummy)
<option value="{{ $status_id }}" @if (!empty($filters['status']) && in_array($status_id, $filters['status']))selected="selected"@endif>{{ App\Conversation::statusCodeToName($status_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['state'])) active @endif" data-filter="state">
<label>{{ __('State') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[state][]" class="form-control filter-multiple" multiple @if (empty($filters['state'])) disabled @endif>
{{--<option value=""></option>--}}
@foreach (App\Conversation::$states as $state_id => $dummy)
<option value="{{ $state_id }}" @if (!empty($filters['state']) && in_array($state_id, $filters['state']))selected="selected"@endif>{{ App\Conversation::stateCodeToName($state_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['subject'])) active @endif" data-filter="subject">
<label>{{ __('Subject') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[subject]" value="{{ $filters['subject'] ?? ''}}" class="form-control" @if (empty($filters['subject'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['attachments'])) active @endif" data-filter="attachments">
<label>{{ __('Attachments') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[attachments]" class="form-control" @if (empty($filters['attachments'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['attachments']) && $filters['attachments'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
<option value="no" @if (!empty($filters['attachments']) && $filters['attachments'] == 'no')selected="selected"@endif>{{ __('No') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['type'])) active @endif" data-filter="type">
<label>{{ __('Type') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[type]" class="form-control" @if (empty($filters['type'])) disabled @endif>
<option value=""></option>
@foreach (App\Conversation::$types as $type_id => $dummy)
<option value="{{ $type_id }}" @if (!empty($filters['type']) && $filters['type'] == $type_id)selected="selected"@endif>{{ App\Conversation::typeToName($type_id) }}</option>
@endforeach
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['body'])) active @endif" data-filter="body">
<label>{{ __('Body') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[body]" value="{{ $filters['body'] ?? ''}}" class="form-control" @if (empty($filters['body'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['number'])) active @endif" data-filter="number">
<label>{{ __('Number') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[number]" value="{{ $filters['number'] ?? ''}}" class="form-control" @if (empty($filters['number'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['following'])) active @endif" data-filter="following">
<label>{{ __('Following') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<select name="f[following]" class="form-control" @if (empty($filters['following'])) disabled @endif>
<option value=""></option>
<option value="yes" @if (!empty($filters['following']) && $filters['following'] == 'yes')selected="selected"@endif>{{ __('Yes') }}</option>
</select>
</div>
<div class="col-sm-6 form-group @if (isset($filters['id'])) active @endif" data-filter="id">
<label>{{ __('ID') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[id]" value="{{ $filters['id'] ?? ''}}" class="form-control" @if (empty($filters['id'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['after'])) active @endif" data-filter="after">
<label>{{ __('After') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[after]" value="{{ $filters['after'] ?? ''}}" class="form-control input-date" @if (empty($filters['after'])) disabled @endif>
</div>
<div class="col-sm-6 form-group @if (isset($filters['before'])) active @endif" data-filter="before">
<label>{{ __('Before') }} <b class="remove" data-toggle="tooltip" title="{{ __('Remove filter') }}">×</b></label>
<input type="text" name="f[before]" value="{{ $filters['before'] ?? ''}}" class="form-control input-date" @if (empty($filters['before'])) disabled @endif>
</div>
@action('search.display_filters', $filters, $filters_data, $mode)
</div>
<div class="input-group input-group-lg1">
<input type="text" class="form-control" name="q" value="{{ $q }}">
<span class="input-group-btn">
<button class="btn btn-default" type="submit">{{ __('Search') }}</button>
</span>
</div>
</form>
</div>
<div class="search-results">
<ul class="nav nav-tabs nav-tabs-main margin-top">
@if (Eventy::filter('search.is_tab_visible', true, App\Conversation::SEARCH_MODE_CONV))
<li @if ($mode == App\Conversation::SEARCH_MODE_CONV)class="active search-tab-conv"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CONV])) }}">{{ __('Conversations') }} <b>({{ $conversations->total() }})</b>@action('search.conversations_tab_append', $filters, $conversations->total())</a></li>
@endif
<li @if ($mode == App\Conversation::SEARCH_MODE_CUSTOMERS)class="active"@endif><a href="{{ \Helper::fixProtocol(request()->fullUrlWithQuery(['mode' => App\Conversation::SEARCH_MODE_CUSTOMERS])) }}">{{ __('Customers') }} <b>({{ $customers->total() }})</b></a></li>
</ul>
@if ($mode == App\Conversation::SEARCH_MODE_CONV)
@include('conversations/conversations_table', ['mailbox' => $search_mailbox, 'params' => ['target_blank' => true, 'show_mailbox' => (count(Auth::user()->mailboxesCanView(true)) > 1)]])
@else
@include('freescout-restricted-customers::customers/partials/customers_table')
@endif
</div>
@endsection
@include('partials/include_datepicker')
@section('javascript')
@parent
searchInit();
@endsection

View file

@ -1,36 +0,0 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
use Illuminate\Support\Facades\Route;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\ConversationsController;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CrmController;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Http\Controllers\CustomersController;
// FIXME: Routes are not correctly exposed to the main application,
// routes/web.php and Modules/Crm/Http/routes.php must be manually edited.
// Customers
Route::get('/customers/{id}/edit', CustomersController::class . '@update')->name('customers.update');
Route::post('/customers/{id}/edit', CustomersController::class . '@updateSave');
Route::get('/customers/{id}/', CustomersController::class . '@conversations')->name('customers.conversations');
Route::get('/customers/ajax-search', ['uses' => CustomersController::class . '@ajaxSearch', 'laroute' => true])->name('customers.ajax_search');
Route::post('/customers/ajax', ['uses' => CustomersController::class . '@ajax', 'laroute' => true])->name('customers.ajax');
// Conversations
Route::get('/search', ConversationsController::class . '@search')->name('conversations.search');
// Crm module
Route::group([ 'roles' => ['user', 'admin'] ], function() {
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('freescout-restricted-customers.create_customer');
// The Crm module initialization will crash if no route named "crm.create_customer" is set.
Route::get('/customers/new', CrmController::class . '@createCustomer')->name('crm.create_customer');
Route::post('/customers/new', CrmController::class . '@createCustomerSave');
Route::get('/crm/ajax-html/{action}/{param?}', ['uses' => CrmController::class . '@ajaxHtml'])->name('crm.ajax_html');
Route::get('/customers/fields/ajax-search', ['uses' => CrmController::class . '@ajaxSearch', 'laroute' => true])->name('crm.ajax_search');
Route::post('/crm/ajax', ['uses' => CrmController::class . '@ajax', 'laroute' => true])->name('crm.ajax');
});
Route::group([ 'roles' => ['admin'] ], function() {
Route::post('/customers/export', ['uses' => CrmController::class . '@export'])->name('crm.export');
Route::post('/crm/ajax-admin', ['uses' => CrmController::class . '@ajaxAdmin', 'laroute' => true])->name('crm.ajax_admin');
});

View file

@ -1,38 +0,0 @@
<?php
/*
SPDX-License-Identifier: AGPL-3.0-only
SPDX-FileCopyrightText: © 2024 Millions Missing FRANCE <info@millionsmissing.fr>
*/
namespace MillionsMissingFrance\FreescoutRestrictedCustomers;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;
use MillionsMissingFrance\FreescoutRestrictedCustomers\Console\Commands\FetchEmails;
class FreescoutRestrictedCustomersServiceProvider extends ServiceProvider {
public function register() {
//
}
public function boot() {
$this->loadMigrationsFrom(__DIR__ . '/../database/migrations');
$this->registerRoutes();
$this->loadViewsFrom(__DIR__.'/../resources/views', 'freescout-restricted-customers');
$this->commands([
FetchEmails::class,
]);
}
protected function registerRoutes() {
Route::group($this->routeConfiguration(), function () {
$this->loadRoutesFrom(__DIR__ . '/../routes/web.php');
});
}
protected function routeConfiguration() {
return [
'middleware' => ['web', 'auth', 'roles'],
];
}
}

17
start.php Normal file
View file

@ -0,0 +1,17 @@
<?php
/*
|--------------------------------------------------------------------------
| Register Namespaces And Routes
|--------------------------------------------------------------------------
|
| When a module starting, this file will executed automatically. This helps
| to register some namespaces like translator or view. Also this file
| will load the routes file for each module. You may also modify
| this file as you want.
|
*/
if (!app()->routesAreCached()) {
require __DIR__ . '/Http/routes.php';
}