From 530d336e3a753b64907c882016b202cbe138e048 Mon Sep 17 00:00:00 2001 From: Mohammad Hafijul Islam Date: Mon, 26 Feb 2024 15:09:10 +0600 Subject: [PATCH] code formatted and optimized --- config/chat.php | 19 +++++++++---- ..._12_03_194233_create_chat_groups_table.php | 3 +- ..._194247_create_chat_participants_table.php | 3 +- ...2_03_194256_create_chat_messages_table.php | 3 +- routes/api.php | 15 ++++++---- src/Chat.php | 16 +++++++---- src/ChatServiceProvider.php | 14 +++++----- src/Exceptions/ChatException.php | 4 +-- src/Facades/Chat.php | 9 ++++-- src/Http/Controllers/ChatGroupController.php | 16 +++++------ .../Controllers/ChatMessageController.php | 16 +++++------ .../Controllers/ChatParticipantController.php | 16 +++++------ src/Http/Requests/ImportChatGroupRequest.php | 3 +- .../Requests/ImportChatMessageRequest.php | 3 +- .../Requests/ImportChatParticipantRequest.php | 3 +- src/Http/Requests/IndexChatGroupRequest.php | 6 ++-- src/Http/Requests/IndexChatMessageRequest.php | 6 ++-- .../Requests/IndexChatParticipantRequest.php | 6 ++-- src/Http/Requests/StoreChatGroupRequest.php | 3 +- src/Http/Requests/StoreChatMessageRequest.php | 3 +- .../Requests/StoreChatParticipantRequest.php | 3 +- src/Http/Requests/UpdateChatGroupRequest.php | 3 +- .../Requests/UpdateChatMessageRequest.php | 3 +- .../Requests/UpdateChatParticipantRequest.php | 3 +- src/Http/Resources/ChatGroupCollection.php | 2 +- src/Http/Resources/ChatGroupResource.php | 3 +- src/Http/Resources/ChatMessageCollection.php | 2 +- src/Http/Resources/ChatMessageResource.php | 3 +- .../Resources/ChatParticipantCollection.php | 2 +- .../Resources/ChatParticipantResource.php | 3 +- src/Interfaces/ChatGroupRepository.php | 5 ++-- src/Interfaces/ChatMessageRepository.php | 5 ++-- src/Interfaces/ChatParticipantRepository.php | 5 ++-- src/Models/ChatGroup.php | 4 +-- src/Models/ChatMessage.php | 4 +-- src/Models/ChatParticipant.php | 4 +-- .../Eloquent/ChatGroupRepository.php | 8 +++--- .../Eloquent/ChatMessageRepository.php | 8 +++--- .../Eloquent/ChatParticipantRepository.php | 8 +++--- .../Mongodb/ChatGroupRepository.php | 7 +++-- .../Mongodb/ChatMessageRepository.php | 7 +++-- .../Mongodb/ChatParticipantRepository.php | 7 +++-- src/RouteServiceProvider.php | 2 +- src/Services/ChatGroupService.php | 28 +++++++++---------- src/Services/ChatMessageService.php | 28 +++++++++---------- src/Services/ChatParticipantService.php | 28 +++++++++---------- tests/TestCase.php | 24 ++++++++-------- 47 files changed, 207 insertions(+), 169 deletions(-) diff --git a/config/chat.php b/config/chat.php index f8e909d..a4e5b72 100644 --- a/config/chat.php +++ b/config/chat.php @@ -1,6 +1,13 @@ \Fintech\Chat\Models\ChatGroup::class, + 'chat_group_model' => ChatGroup::class, /* |-------------------------------------------------------------------------- @@ -40,7 +47,7 @@ | | This value will be used to across system where model is needed */ - 'chat_participant_model' => \Fintech\Chat\Models\ChatParticipant::class, + 'chat_participant_model' => ChatParticipant::class, /* |-------------------------------------------------------------------------- @@ -49,7 +56,7 @@ | | This value will be used to across system where model is needed */ - 'chat_message_model' => \Fintech\Chat\Models\ChatMessage::class, + 'chat_message_model' => ChatMessage::class, //** Model Config Point Do not Remove **// @@ -62,11 +69,11 @@ */ 'repositories' => [ - \Fintech\Chat\Interfaces\ChatGroupRepository::class => \Fintech\Chat\Repositories\Eloquent\ChatGroupRepository::class, + \Fintech\Chat\Interfaces\ChatGroupRepository::class => ChatGroupRepository::class, - \Fintech\Chat\Interfaces\ChatParticipantRepository::class => \Fintech\Chat\Repositories\Eloquent\ChatParticipantRepository::class, + \Fintech\Chat\Interfaces\ChatParticipantRepository::class => ChatParticipantRepository::class, - \Fintech\Chat\Interfaces\ChatMessageRepository::class => \Fintech\Chat\Repositories\Eloquent\ChatMessageRepository::class, + \Fintech\Chat\Interfaces\ChatMessageRepository::class => ChatMessageRepository::class, //** Repository Binding Config Point Do not Remove **// ], diff --git a/database/migrations/2023_12_03_194233_create_chat_groups_table.php b/database/migrations/2023_12_03_194233_create_chat_groups_table.php index d9afebe..db12f75 100644 --- a/database/migrations/2023_12_03_194233_create_chat_groups_table.php +++ b/database/migrations/2023_12_03_194233_create_chat_groups_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_12_03_194247_create_chat_participants_table.php b/database/migrations/2023_12_03_194247_create_chat_participants_table.php index 2343b58..bc19223 100644 --- a/database/migrations/2023_12_03_194247_create_chat_participants_table.php +++ b/database/migrations/2023_12_03_194247_create_chat_participants_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/database/migrations/2023_12_03_194256_create_chat_messages_table.php b/database/migrations/2023_12_03_194256_create_chat_messages_table.php index f54ff95..facfbf2 100644 --- a/database/migrations/2023_12_03_194256_create_chat_messages_table.php +++ b/database/migrations/2023_12_03_194256_create_chat_messages_table.php @@ -4,8 +4,7 @@ use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; -return new class extends Migration -{ +return new class extends Migration { /** * Run the migrations. */ diff --git a/routes/api.php b/routes/api.php index b83def9..b74ce9a 100644 --- a/routes/api.php +++ b/routes/api.php @@ -1,5 +1,8 @@ name('chat.')->group(function () { - Route::apiResource('chat-groups', \Fintech\Chat\Http\Controllers\ChatGroupController::class); - Route::post('chat-groups/{chat_group}/restore', [\Fintech\Chat\Http\Controllers\ChatGroupController::class, 'restore'])->name('chat-groups.restore'); + Route::apiResource('chat-groups', ChatGroupController::class); + Route::post('chat-groups/{chat_group}/restore', [ChatGroupController::class, 'restore'])->name('chat-groups.restore'); - Route::apiResource('chat-participants', \Fintech\Chat\Http\Controllers\ChatParticipantController::class); - Route::post('chat-participants/{chat_participant}/restore', [\Fintech\Chat\Http\Controllers\ChatParticipantController::class, 'restore'])->name('chat-participants.restore'); + Route::apiResource('chat-participants', ChatParticipantController::class); + Route::post('chat-participants/{chat_participant}/restore', [ChatParticipantController::class, 'restore'])->name('chat-participants.restore'); - Route::apiResource('chat-messages', \Fintech\Chat\Http\Controllers\ChatMessageController::class); - Route::post('chat-messages/{chat_message}/restore', [\Fintech\Chat\Http\Controllers\ChatMessageController::class, 'restore'])->name('chat-messages.restore'); + Route::apiResource('chat-messages', ChatMessageController::class); + Route::post('chat-messages/{chat_message}/restore', [ChatMessageController::class, 'restore'])->name('chat-messages.restore'); //DO NOT REMOVE THIS LINE// }); diff --git a/src/Chat.php b/src/Chat.php index 00973b9..150678b 100644 --- a/src/Chat.php +++ b/src/Chat.php @@ -2,30 +2,34 @@ namespace Fintech\Chat; +use Fintech\Chat\Services\ChatGroupService; +use Fintech\Chat\Services\ChatMessageService; +use Fintech\Chat\Services\ChatParticipantService; + class Chat { /** - * @return \Fintech\Chat\Services\ChatGroupService + * @return ChatGroupService */ public function chatGroup() { - return app(\Fintech\Chat\Services\ChatGroupService::class); + return app(ChatGroupService::class); } /** - * @return \Fintech\Chat\Services\ChatParticipantService + * @return ChatParticipantService */ public function chatParticipant() { - return app(\Fintech\Chat\Services\ChatParticipantService::class); + return app(ChatParticipantService::class); } /** - * @return \Fintech\Chat\Services\ChatMessageService + * @return ChatMessageService */ public function chatMessage() { - return app(\Fintech\Chat\Services\ChatMessageService::class); + return app(ChatMessageService::class); } //** Crud Service Method Point Do not Remove **// diff --git a/src/ChatServiceProvider.php b/src/ChatServiceProvider.php index 9b26fea..8f89bb2 100644 --- a/src/ChatServiceProvider.php +++ b/src/ChatServiceProvider.php @@ -16,7 +16,7 @@ class ChatServiceProvider extends ServiceProvider public function register() { $this->mergeConfigFrom( - __DIR__.'/../config/chat.php', 'fintech.chat' + __DIR__ . '/../config/chat.php', 'fintech.chat' ); $this->app->register(RouteServiceProvider::class); @@ -29,21 +29,21 @@ public function register() public function boot(): void { $this->publishes([ - __DIR__.'/../config/chat.php' => config_path('fintech/chat.php'), + __DIR__ . '/../config/chat.php' => config_path('fintech/chat.php'), ]); - $this->loadMigrationsFrom(__DIR__.'/../database/migrations'); + $this->loadMigrationsFrom(__DIR__ . '/../database/migrations'); - $this->loadTranslationsFrom(__DIR__.'/../lang', 'chat'); + $this->loadTranslationsFrom(__DIR__ . '/../lang', 'chat'); $this->publishes([ - __DIR__.'/../lang' => $this->app->langPath('vendor/chat'), + __DIR__ . '/../lang' => $this->app->langPath('vendor/chat'), ]); - $this->loadViewsFrom(__DIR__.'/../resources/views', 'chat'); + $this->loadViewsFrom(__DIR__ . '/../resources/views', 'chat'); $this->publishes([ - __DIR__.'/../resources/views' => resource_path('views/vendor/chat'), + __DIR__ . '/../resources/views' => resource_path('views/vendor/chat'), ]); if ($this->app->runningInConsole()) { diff --git a/src/Exceptions/ChatException.php b/src/Exceptions/ChatException.php index 434c89c..1bb9689 100644 --- a/src/Exceptions/ChatException.php +++ b/src/Exceptions/ChatException.php @@ -13,8 +13,8 @@ class ChatException extends Exception /** * CoreException constructor. * - * @param string $message - * @param int $code + * @param string $message + * @param int $code */ public function __construct($message = '', $code = 0, Throwable $previous = null) { diff --git a/src/Facades/Chat.php b/src/Facades/Chat.php index f3867a7..87cf233 100644 --- a/src/Facades/Chat.php +++ b/src/Facades/Chat.php @@ -2,12 +2,15 @@ namespace Fintech\Chat\Facades; +use Fintech\Chat\Services\ChatGroupService; +use Fintech\Chat\Services\ChatMessageService; +use Fintech\Chat\Services\ChatParticipantService; use Illuminate\Support\Facades\Facade; /** - * @method static \Fintech\Chat\Services\ChatGroupService chatGroup() - * @method static \Fintech\Chat\Services\ChatParticipantService chatParticipant() - * @method static \Fintech\Chat\Services\ChatMessageService chatMessage() + * @method static ChatGroupService chatGroup() + * @method static ChatParticipantService chatParticipant() + * @method static ChatMessageService chatMessage() * // Crud Service Method Point Do not Remove // * * @see \Fintech\Chat\Chat diff --git a/src/Http/Controllers/ChatGroupController.php b/src/Http/Controllers/ChatGroupController.php index 4ada659..0eb6372 100644 --- a/src/Http/Controllers/ChatGroupController.php +++ b/src/Http/Controllers/ChatGroupController.php @@ -70,7 +70,7 @@ public function store(StoreChatGroupRequest $request): JsonResponse $chatGroup = Chat::chatGroup()->create($inputs); - if (! $chatGroup) { + if (!$chatGroup) { throw (new StoreOperationException)->setModel(config('fintech.chat.chat_group_model')); } @@ -99,7 +99,7 @@ public function show(string|int $id): ChatGroupResource|JsonResponse $chatGroup = Chat::chatGroup()->find($id); - if (! $chatGroup) { + if (!$chatGroup) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_group_model'), $id); } @@ -130,13 +130,13 @@ public function update(UpdateChatGroupRequest $request, string|int $id): JsonRes $chatGroup = Chat::chatGroup()->find($id); - if (! $chatGroup) { + if (!$chatGroup) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_group_model'), $id); } $inputs = $request->validated(); - if (! Chat::chatGroup()->update($id, $inputs)) { + if (!Chat::chatGroup()->update($id, $inputs)) { throw (new UpdateOperationException)->setModel(config('fintech.chat.chat_group_model'), $id); } @@ -170,11 +170,11 @@ public function destroy(string|int $id) $chatGroup = Chat::chatGroup()->find($id); - if (! $chatGroup) { + if (!$chatGroup) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_group_model'), $id); } - if (! Chat::chatGroup()->destroy($id)) { + if (!Chat::chatGroup()->destroy($id)) { throw (new DeleteOperationException())->setModel(config('fintech.chat.chat_group_model'), $id); } @@ -206,11 +206,11 @@ public function restore(string|int $id) $chatGroup = Chat::chatGroup()->find($id, true); - if (! $chatGroup) { + if (!$chatGroup) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_group_model'), $id); } - if (! Chat::chatGroup()->restore($id)) { + if (!Chat::chatGroup()->restore($id)) { throw (new RestoreOperationException())->setModel(config('fintech.chat.chat_group_model'), $id); } diff --git a/src/Http/Controllers/ChatMessageController.php b/src/Http/Controllers/ChatMessageController.php index 05c5dc0..f3a71dc 100644 --- a/src/Http/Controllers/ChatMessageController.php +++ b/src/Http/Controllers/ChatMessageController.php @@ -70,7 +70,7 @@ public function store(StoreChatMessageRequest $request): JsonResponse $chatMessage = Chat::chatMessage()->create($inputs); - if (! $chatMessage) { + if (!$chatMessage) { throw (new StoreOperationException)->setModel(config('fintech.chat.chat_message_model')); } @@ -99,7 +99,7 @@ public function show(string|int $id): ChatMessageResource|JsonResponse $chatMessage = Chat::chatMessage()->find($id); - if (! $chatMessage) { + if (!$chatMessage) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_message_model'), $id); } @@ -130,13 +130,13 @@ public function update(UpdateChatMessageRequest $request, string|int $id): JsonR $chatMessage = Chat::chatMessage()->find($id); - if (! $chatMessage) { + if (!$chatMessage) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_message_model'), $id); } $inputs = $request->validated(); - if (! Chat::chatMessage()->update($id, $inputs)) { + if (!Chat::chatMessage()->update($id, $inputs)) { throw (new UpdateOperationException)->setModel(config('fintech.chat.chat_message_model'), $id); } @@ -170,11 +170,11 @@ public function destroy(string|int $id) $chatMessage = Chat::chatMessage()->find($id); - if (! $chatMessage) { + if (!$chatMessage) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_message_model'), $id); } - if (! Chat::chatMessage()->destroy($id)) { + if (!Chat::chatMessage()->destroy($id)) { throw (new DeleteOperationException())->setModel(config('fintech.chat.chat_message_model'), $id); } @@ -206,11 +206,11 @@ public function restore(string|int $id) $chatMessage = Chat::chatMessage()->find($id, true); - if (! $chatMessage) { + if (!$chatMessage) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_message_model'), $id); } - if (! Chat::chatMessage()->restore($id)) { + if (!Chat::chatMessage()->restore($id)) { throw (new RestoreOperationException())->setModel(config('fintech.chat.chat_message_model'), $id); } diff --git a/src/Http/Controllers/ChatParticipantController.php b/src/Http/Controllers/ChatParticipantController.php index 1c3cf38..bbc9787 100644 --- a/src/Http/Controllers/ChatParticipantController.php +++ b/src/Http/Controllers/ChatParticipantController.php @@ -70,7 +70,7 @@ public function store(StoreChatParticipantRequest $request): JsonResponse $chatParticipant = Chat::chatParticipant()->create($inputs); - if (! $chatParticipant) { + if (!$chatParticipant) { throw (new StoreOperationException)->setModel(config('fintech.chat.chat_participant_model')); } @@ -99,7 +99,7 @@ public function show(string|int $id): ChatParticipantResource|JsonResponse $chatParticipant = Chat::chatParticipant()->find($id); - if (! $chatParticipant) { + if (!$chatParticipant) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_participant_model'), $id); } @@ -130,13 +130,13 @@ public function update(UpdateChatParticipantRequest $request, string|int $id): J $chatParticipant = Chat::chatParticipant()->find($id); - if (! $chatParticipant) { + if (!$chatParticipant) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_participant_model'), $id); } $inputs = $request->validated(); - if (! Chat::chatParticipant()->update($id, $inputs)) { + if (!Chat::chatParticipant()->update($id, $inputs)) { throw (new UpdateOperationException)->setModel(config('fintech.chat.chat_participant_model'), $id); } @@ -170,11 +170,11 @@ public function destroy(string|int $id) $chatParticipant = Chat::chatParticipant()->find($id); - if (! $chatParticipant) { + if (!$chatParticipant) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_participant_model'), $id); } - if (! Chat::chatParticipant()->destroy($id)) { + if (!Chat::chatParticipant()->destroy($id)) { throw (new DeleteOperationException())->setModel(config('fintech.chat.chat_participant_model'), $id); } @@ -206,11 +206,11 @@ public function restore(string|int $id) $chatParticipant = Chat::chatParticipant()->find($id, true); - if (! $chatParticipant) { + if (!$chatParticipant) { throw (new ModelNotFoundException)->setModel(config('fintech.chat.chat_participant_model'), $id); } - if (! Chat::chatParticipant()->restore($id)) { + if (!Chat::chatParticipant()->restore($id)) { throw (new RestoreOperationException())->setModel(config('fintech.chat.chat_participant_model'), $id); } diff --git a/src/Http/Requests/ImportChatGroupRequest.php b/src/Http/Requests/ImportChatGroupRequest.php index d84961f..82867fb 100644 --- a/src/Http/Requests/ImportChatGroupRequest.php +++ b/src/Http/Requests/ImportChatGroupRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class ImportChatGroupRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/ImportChatMessageRequest.php b/src/Http/Requests/ImportChatMessageRequest.php index 7661870..9f83fdc 100644 --- a/src/Http/Requests/ImportChatMessageRequest.php +++ b/src/Http/Requests/ImportChatMessageRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class ImportChatMessageRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/ImportChatParticipantRequest.php b/src/Http/Requests/ImportChatParticipantRequest.php index cf2b25d..42d6eae 100644 --- a/src/Http/Requests/ImportChatParticipantRequest.php +++ b/src/Http/Requests/ImportChatParticipantRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class ImportChatParticipantRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/IndexChatGroupRequest.php b/src/Http/Requests/IndexChatGroupRequest.php index 779bcd3..b171d4c 100644 --- a/src/Http/Requests/IndexChatGroupRequest.php +++ b/src/Http/Requests/IndexChatGroupRequest.php @@ -2,11 +2,13 @@ namespace Fintech\Chat\Http\Requests; +use Fintech\Core\Traits\HasPaginateQuery; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class IndexChatGroupRequest extends FormRequest { - use \Fintech\Core\Traits\HasPaginateQuery; + use HasPaginateQuery; /** * Determine if the user is authorized to make this request. @@ -19,7 +21,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/IndexChatMessageRequest.php b/src/Http/Requests/IndexChatMessageRequest.php index 240fc55..4c1cd08 100644 --- a/src/Http/Requests/IndexChatMessageRequest.php +++ b/src/Http/Requests/IndexChatMessageRequest.php @@ -2,11 +2,13 @@ namespace Fintech\Chat\Http\Requests; +use Fintech\Core\Traits\HasPaginateQuery; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class IndexChatMessageRequest extends FormRequest { - use \Fintech\Core\Traits\HasPaginateQuery; + use HasPaginateQuery; /** * Determine if the user is authorized to make this request. @@ -19,7 +21,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/IndexChatParticipantRequest.php b/src/Http/Requests/IndexChatParticipantRequest.php index 2bdd568..f790593 100644 --- a/src/Http/Requests/IndexChatParticipantRequest.php +++ b/src/Http/Requests/IndexChatParticipantRequest.php @@ -2,11 +2,13 @@ namespace Fintech\Chat\Http\Requests; +use Fintech\Core\Traits\HasPaginateQuery; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class IndexChatParticipantRequest extends FormRequest { - use \Fintech\Core\Traits\HasPaginateQuery; + use HasPaginateQuery; /** * Determine if the user is authorized to make this request. @@ -19,7 +21,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/StoreChatGroupRequest.php b/src/Http/Requests/StoreChatGroupRequest.php index ce39bcd..2ff158f 100644 --- a/src/Http/Requests/StoreChatGroupRequest.php +++ b/src/Http/Requests/StoreChatGroupRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class StoreChatGroupRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/StoreChatMessageRequest.php b/src/Http/Requests/StoreChatMessageRequest.php index 3018b5f..247cc24 100644 --- a/src/Http/Requests/StoreChatMessageRequest.php +++ b/src/Http/Requests/StoreChatMessageRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class StoreChatMessageRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/StoreChatParticipantRequest.php b/src/Http/Requests/StoreChatParticipantRequest.php index 06e4c5d..1ed87ba 100644 --- a/src/Http/Requests/StoreChatParticipantRequest.php +++ b/src/Http/Requests/StoreChatParticipantRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class StoreChatParticipantRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/UpdateChatGroupRequest.php b/src/Http/Requests/UpdateChatGroupRequest.php index 56c855a..7ba2088 100644 --- a/src/Http/Requests/UpdateChatGroupRequest.php +++ b/src/Http/Requests/UpdateChatGroupRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class UpdateChatGroupRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/UpdateChatMessageRequest.php b/src/Http/Requests/UpdateChatMessageRequest.php index 08cb43b..0028c8b 100644 --- a/src/Http/Requests/UpdateChatMessageRequest.php +++ b/src/Http/Requests/UpdateChatMessageRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class UpdateChatMessageRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Requests/UpdateChatParticipantRequest.php b/src/Http/Requests/UpdateChatParticipantRequest.php index 430f028..6d775ca 100644 --- a/src/Http/Requests/UpdateChatParticipantRequest.php +++ b/src/Http/Requests/UpdateChatParticipantRequest.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Requests; +use Illuminate\Contracts\Validation\ValidationRule; use Illuminate\Foundation\Http\FormRequest; class UpdateChatParticipantRequest extends FormRequest @@ -17,7 +18,7 @@ public function authorize(): bool /** * Get the validation rules that apply to the request. * - * @return array + * @return array */ public function rules(): array { diff --git a/src/Http/Resources/ChatGroupCollection.php b/src/Http/Resources/ChatGroupCollection.php index 664afec..ef708b6 100644 --- a/src/Http/Resources/ChatGroupCollection.php +++ b/src/Http/Resources/ChatGroupCollection.php @@ -11,7 +11,7 @@ class ChatGroupCollection extends ResourceCollection /** * Transform the resource collection into an array. * - * @param Request $request + * @param Request $request * @return array */ public function toArray($request) diff --git a/src/Http/Resources/ChatGroupResource.php b/src/Http/Resources/ChatGroupResource.php index df66039..88006b7 100644 --- a/src/Http/Resources/ChatGroupResource.php +++ b/src/Http/Resources/ChatGroupResource.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class ChatGroupResource extends JsonResource @@ -9,7 +10,7 @@ class ChatGroupResource extends JsonResource /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request + * @param Request * @return array */ public function toArray($request) diff --git a/src/Http/Resources/ChatMessageCollection.php b/src/Http/Resources/ChatMessageCollection.php index b7cbafc..1af9bfc 100644 --- a/src/Http/Resources/ChatMessageCollection.php +++ b/src/Http/Resources/ChatMessageCollection.php @@ -11,7 +11,7 @@ class ChatMessageCollection extends ResourceCollection /** * Transform the resource collection into an array. * - * @param Request $request + * @param Request $request * @return array */ public function toArray($request) diff --git a/src/Http/Resources/ChatMessageResource.php b/src/Http/Resources/ChatMessageResource.php index 80258f1..6d4b7b5 100644 --- a/src/Http/Resources/ChatMessageResource.php +++ b/src/Http/Resources/ChatMessageResource.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class ChatMessageResource extends JsonResource @@ -9,7 +10,7 @@ class ChatMessageResource extends JsonResource /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request + * @param Request * @return array */ public function toArray($request) diff --git a/src/Http/Resources/ChatParticipantCollection.php b/src/Http/Resources/ChatParticipantCollection.php index 43f19bb..355f782 100644 --- a/src/Http/Resources/ChatParticipantCollection.php +++ b/src/Http/Resources/ChatParticipantCollection.php @@ -11,7 +11,7 @@ class ChatParticipantCollection extends ResourceCollection /** * Transform the resource collection into an array. * - * @param Request $request + * @param Request $request * @return array */ public function toArray($request) diff --git a/src/Http/Resources/ChatParticipantResource.php b/src/Http/Resources/ChatParticipantResource.php index 5099beb..eb2b4c5 100644 --- a/src/Http/Resources/ChatParticipantResource.php +++ b/src/Http/Resources/ChatParticipantResource.php @@ -2,6 +2,7 @@ namespace Fintech\Chat\Http\Resources; +use Illuminate\Http\Request; use Illuminate\Http\Resources\Json\JsonResource; class ChatParticipantResource extends JsonResource @@ -9,7 +10,7 @@ class ChatParticipantResource extends JsonResource /** * Transform the resource into an array. * - * @param \Illuminate\Http\Request + * @param Request * @return array */ public function toArray($request) diff --git a/src/Interfaces/ChatGroupRepository.php b/src/Interfaces/ChatGroupRepository.php index ebdc3c4..8aabe9d 100644 --- a/src/Interfaces/ChatGroupRepository.php +++ b/src/Interfaces/ChatGroupRepository.php @@ -5,6 +5,7 @@ use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Model as EloquentModel; use Illuminate\Support\Collection; +use InvalidArgumentException; use MongoDB\Laravel\Eloquent\Model as MongodbModel; /** @@ -37,7 +38,7 @@ public function update(int|string $id, array $attributes = []); /** * find and delete a entry from records * - * @param bool $onlyTrashed + * @param bool $onlyTrashed * @return EloquentModel|MongodbModel|null */ public function find(int|string $id, $onlyTrashed = false); @@ -50,7 +51,7 @@ public function delete(int|string $id); /** * find and restore a entry from records * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function restore(int|string $id); } diff --git a/src/Interfaces/ChatMessageRepository.php b/src/Interfaces/ChatMessageRepository.php index 6ea9afc..5cbf1bc 100644 --- a/src/Interfaces/ChatMessageRepository.php +++ b/src/Interfaces/ChatMessageRepository.php @@ -5,6 +5,7 @@ use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Model as EloquentModel; use Illuminate\Support\Collection; +use InvalidArgumentException; use MongoDB\Laravel\Eloquent\Model as MongodbModel; /** @@ -37,7 +38,7 @@ public function update(int|string $id, array $attributes = []); /** * find and delete a entry from records * - * @param bool $onlyTrashed + * @param bool $onlyTrashed * @return EloquentModel|MongodbModel|null */ public function find(int|string $id, $onlyTrashed = false); @@ -50,7 +51,7 @@ public function delete(int|string $id); /** * find and restore a entry from records * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function restore(int|string $id); } diff --git a/src/Interfaces/ChatParticipantRepository.php b/src/Interfaces/ChatParticipantRepository.php index 696b9bd..8f0413d 100644 --- a/src/Interfaces/ChatParticipantRepository.php +++ b/src/Interfaces/ChatParticipantRepository.php @@ -5,6 +5,7 @@ use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Model as EloquentModel; use Illuminate\Support\Collection; +use InvalidArgumentException; use MongoDB\Laravel\Eloquent\Model as MongodbModel; /** @@ -37,7 +38,7 @@ public function update(int|string $id, array $attributes = []); /** * find and delete a entry from records * - * @param bool $onlyTrashed + * @param bool $onlyTrashed * @return EloquentModel|MongodbModel|null */ public function find(int|string $id, $onlyTrashed = false); @@ -50,7 +51,7 @@ public function delete(int|string $id); /** * find and restore a entry from records * - * @throws \InvalidArgumentException + * @throws InvalidArgumentException */ public function restore(int|string $id); } diff --git a/src/Models/ChatGroup.php b/src/Models/ChatGroup.php index 9bdf627..e757da0 100644 --- a/src/Models/ChatGroup.php +++ b/src/Models/ChatGroup.php @@ -2,13 +2,13 @@ namespace Fintech\Chat\Models; +use Fintech\Core\Abstracts\BaseModel; use Fintech\Core\Traits\AuditableTrait; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; use Spatie\MediaLibrary\HasMedia; use Spatie\MediaLibrary\InteractsWithMedia; -class ChatGroup extends Model implements HasMedia +class ChatGroup extends BaseModel implements HasMedia { use AuditableTrait; use InteractsWithMedia; diff --git a/src/Models/ChatMessage.php b/src/Models/ChatMessage.php index 39be82f..9a4fe0c 100644 --- a/src/Models/ChatMessage.php +++ b/src/Models/ChatMessage.php @@ -2,11 +2,11 @@ namespace Fintech\Chat\Models; +use Fintech\Core\Abstracts\BaseModel; use Fintech\Core\Traits\AuditableTrait; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; -class ChatMessage extends Model +class ChatMessage extends BaseModel { use AuditableTrait; use SoftDeletes; diff --git a/src/Models/ChatParticipant.php b/src/Models/ChatParticipant.php index 55a1570..50789c3 100644 --- a/src/Models/ChatParticipant.php +++ b/src/Models/ChatParticipant.php @@ -2,11 +2,11 @@ namespace Fintech\Chat\Models; +use Fintech\Core\Abstracts\BaseModel; use Fintech\Core\Traits\AuditableTrait; -use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\SoftDeletes; -class ChatParticipant extends Model +class ChatParticipant extends BaseModel { use AuditableTrait; use SoftDeletes; diff --git a/src/Repositories/Eloquent/ChatGroupRepository.php b/src/Repositories/Eloquent/ChatGroupRepository.php index 1938b00..b7b1663 100644 --- a/src/Repositories/Eloquent/ChatGroupRepository.php +++ b/src/Repositories/Eloquent/ChatGroupRepository.php @@ -3,10 +3,10 @@ namespace Fintech\Chat\Repositories\Eloquent; use Fintech\Chat\Interfaces\ChatGroupRepository as InterfacesChatGroupRepository; +use Fintech\Chat\Models\ChatGroup; use Fintech\Core\Repositories\EloquentRepository; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\Model; use InvalidArgumentException; /** @@ -16,9 +16,9 @@ class ChatGroupRepository extends EloquentRepository implements InterfacesChatGr { public function __construct() { - $model = app(config('fintech.chat.chat_group_model', \Fintech\Chat\Models\ChatGroup::class)); + $model = app(config('fintech.chat.chat_group_model', ChatGroup::class)); - if (! $model instanceof Model) { + if (!$model instanceof Model) { throw new InvalidArgumentException("Eloquent repository require model class to be `Illuminate\Database\Eloquent\Model` instance."); } @@ -36,7 +36,7 @@ public function list(array $filters = []) $query = $this->model->newQuery(); //Searching - if (! empty($filters['search'])) { + if (!empty($filters['search'])) { if (is_numeric($filters['search'])) { $query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%"); } else { diff --git a/src/Repositories/Eloquent/ChatMessageRepository.php b/src/Repositories/Eloquent/ChatMessageRepository.php index ecdcd65..9d8f626 100644 --- a/src/Repositories/Eloquent/ChatMessageRepository.php +++ b/src/Repositories/Eloquent/ChatMessageRepository.php @@ -3,10 +3,10 @@ namespace Fintech\Chat\Repositories\Eloquent; use Fintech\Chat\Interfaces\ChatMessageRepository as InterfacesChatMessageRepository; +use Fintech\Chat\Models\ChatMessage; use Fintech\Core\Repositories\EloquentRepository; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\Model; use InvalidArgumentException; /** @@ -16,9 +16,9 @@ class ChatMessageRepository extends EloquentRepository implements InterfacesChat { public function __construct() { - $model = app(config('fintech.chat.chat_message_model', \Fintech\Chat\Models\ChatMessage::class)); + $model = app(config('fintech.chat.chat_message_model', ChatMessage::class)); - if (! $model instanceof Model) { + if (!$model instanceof Model) { throw new InvalidArgumentException("Eloquent repository require model class to be `Illuminate\Database\Eloquent\Model` instance."); } @@ -36,7 +36,7 @@ public function list(array $filters = []) $query = $this->model->newQuery(); //Searching - if (! empty($filters['search'])) { + if (!empty($filters['search'])) { if (is_numeric($filters['search'])) { $query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%"); } else { diff --git a/src/Repositories/Eloquent/ChatParticipantRepository.php b/src/Repositories/Eloquent/ChatParticipantRepository.php index c51a920..aeeceb8 100644 --- a/src/Repositories/Eloquent/ChatParticipantRepository.php +++ b/src/Repositories/Eloquent/ChatParticipantRepository.php @@ -3,10 +3,10 @@ namespace Fintech\Chat\Repositories\Eloquent; use Fintech\Chat\Interfaces\ChatParticipantRepository as InterfacesChatParticipantRepository; +use Fintech\Chat\Models\ChatParticipant; use Fintech\Core\Repositories\EloquentRepository; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Collection; -use Illuminate\Database\Eloquent\Model; use InvalidArgumentException; /** @@ -16,9 +16,9 @@ class ChatParticipantRepository extends EloquentRepository implements Interfaces { public function __construct() { - $model = app(config('fintech.chat.chat_participant_model', \Fintech\Chat\Models\ChatParticipant::class)); + $model = app(config('fintech.chat.chat_participant_model', ChatParticipant::class)); - if (! $model instanceof Model) { + if (!$model instanceof Model) { throw new InvalidArgumentException("Eloquent repository require model class to be `Illuminate\Database\Eloquent\Model` instance."); } @@ -36,7 +36,7 @@ public function list(array $filters = []) $query = $this->model->newQuery(); //Searching - if (! empty($filters['search'])) { + if (!empty($filters['search'])) { if (is_numeric($filters['search'])) { $query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%"); } else { diff --git a/src/Repositories/Mongodb/ChatGroupRepository.php b/src/Repositories/Mongodb/ChatGroupRepository.php index 36159b5..c7f86ee 100644 --- a/src/Repositories/Mongodb/ChatGroupRepository.php +++ b/src/Repositories/Mongodb/ChatGroupRepository.php @@ -3,6 +3,7 @@ namespace Fintech\Chat\Repositories\Mongodb; use Fintech\Chat\Interfaces\ChatGroupRepository as InterfacesChatGroupRepository; +use Fintech\Chat\Models\ChatGroup; use Fintech\Core\Repositories\MongodbRepository; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Collection; @@ -16,9 +17,9 @@ class ChatGroupRepository extends MongodbRepository implements InterfacesChatGro { public function __construct() { - $model = app(config('fintech.chat.chat_group_model', \Fintech\Chat\Models\ChatGroup::class)); + $model = app(config('fintech.chat.chat_group_model', ChatGroup::class)); - if (! $model instanceof Model) { + if (!$model instanceof Model) { throw new InvalidArgumentException("Mongodb repository require model class to be `MongoDB\Laravel\Eloquent\Model` instance."); } @@ -36,7 +37,7 @@ public function list(array $filters = []) $query = $this->model->newQuery(); //Searching - if (! empty($filters['search'])) { + if (!empty($filters['search'])) { if (is_numeric($filters['search'])) { $query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%"); } else { diff --git a/src/Repositories/Mongodb/ChatMessageRepository.php b/src/Repositories/Mongodb/ChatMessageRepository.php index 3b54bb0..2c93c90 100644 --- a/src/Repositories/Mongodb/ChatMessageRepository.php +++ b/src/Repositories/Mongodb/ChatMessageRepository.php @@ -3,6 +3,7 @@ namespace Fintech\Chat\Repositories\Mongodb; use Fintech\Chat\Interfaces\ChatMessageRepository as InterfacesChatMessageRepository; +use Fintech\Chat\Models\ChatMessage; use Fintech\Core\Repositories\MongodbRepository; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Collection; @@ -16,9 +17,9 @@ class ChatMessageRepository extends MongodbRepository implements InterfacesChatM { public function __construct() { - $model = app(config('fintech.chat.chat_message_model', \Fintech\Chat\Models\ChatMessage::class)); + $model = app(config('fintech.chat.chat_message_model', ChatMessage::class)); - if (! $model instanceof Model) { + if (!$model instanceof Model) { throw new InvalidArgumentException("Mongodb repository require model class to be `MongoDB\Laravel\Eloquent\Model` instance."); } @@ -36,7 +37,7 @@ public function list(array $filters = []) $query = $this->model->newQuery(); //Searching - if (! empty($filters['search'])) { + if (!empty($filters['search'])) { if (is_numeric($filters['search'])) { $query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%"); } else { diff --git a/src/Repositories/Mongodb/ChatParticipantRepository.php b/src/Repositories/Mongodb/ChatParticipantRepository.php index 1a8f42e..4372abf 100644 --- a/src/Repositories/Mongodb/ChatParticipantRepository.php +++ b/src/Repositories/Mongodb/ChatParticipantRepository.php @@ -3,6 +3,7 @@ namespace Fintech\Chat\Repositories\Mongodb; use Fintech\Chat\Interfaces\ChatParticipantRepository as InterfacesChatParticipantRepository; +use Fintech\Chat\Models\ChatParticipant; use Fintech\Core\Repositories\MongodbRepository; use Illuminate\Contracts\Pagination\Paginator; use Illuminate\Database\Eloquent\Collection; @@ -16,9 +17,9 @@ class ChatParticipantRepository extends MongodbRepository implements InterfacesC { public function __construct() { - $model = app(config('fintech.chat.chat_participant_model', \Fintech\Chat\Models\ChatParticipant::class)); + $model = app(config('fintech.chat.chat_participant_model', ChatParticipant::class)); - if (! $model instanceof Model) { + if (!$model instanceof Model) { throw new InvalidArgumentException("Mongodb repository require model class to be `MongoDB\Laravel\Eloquent\Model` instance."); } @@ -36,7 +37,7 @@ public function list(array $filters = []) $query = $this->model->newQuery(); //Searching - if (! empty($filters['search'])) { + if (!empty($filters['search'])) { if (is_numeric($filters['search'])) { $query->where($this->model->getKeyName(), 'like', "%{$filters['search']}%"); } else { diff --git a/src/RouteServiceProvider.php b/src/RouteServiceProvider.php index 83e1129..1ac1371 100644 --- a/src/RouteServiceProvider.php +++ b/src/RouteServiceProvider.php @@ -26,7 +26,7 @@ public function boot() Route::prefix("{$root_prefix}api") ->middleware('api') ->namespace($this->namespace) - ->group(__DIR__.'/../routes/api.php'); + ->group(__DIR__ . '/../routes/api.php'); }); } diff --git a/src/Services/ChatGroupService.php b/src/Services/ChatGroupService.php index 2e422a4..6632042 100644 --- a/src/Services/ChatGroupService.php +++ b/src/Services/ChatGroupService.php @@ -17,20 +17,6 @@ public function __construct(ChatGroupRepository $chatGroupRepository) $this->chatGroupRepository = $chatGroupRepository; } - /** - * @return mixed - */ - public function list(array $filters = []) - { - return $this->chatGroupRepository->list($filters); - - } - - public function create(array $inputs = []) - { - return $this->chatGroupRepository->create($inputs); - } - public function find($id, $onlyTrashed = false) { return $this->chatGroupRepository->find($id, $onlyTrashed); @@ -56,8 +42,22 @@ public function export(array $filters) return $this->chatGroupRepository->list($filters); } + /** + * @return mixed + */ + public function list(array $filters = []) + { + return $this->chatGroupRepository->list($filters); + + } + public function import(array $filters) { return $this->chatGroupRepository->create($filters); } + + public function create(array $inputs = []) + { + return $this->chatGroupRepository->create($inputs); + } } diff --git a/src/Services/ChatMessageService.php b/src/Services/ChatMessageService.php index 1e255a7..7b54b06 100644 --- a/src/Services/ChatMessageService.php +++ b/src/Services/ChatMessageService.php @@ -17,20 +17,6 @@ public function __construct(ChatMessageRepository $chatMessageRepository) $this->chatMessageRepository = $chatMessageRepository; } - /** - * @return mixed - */ - public function list(array $filters = []) - { - return $this->chatMessageRepository->list($filters); - - } - - public function create(array $inputs = []) - { - return $this->chatMessageRepository->create($inputs); - } - public function find($id, $onlyTrashed = false) { return $this->chatMessageRepository->find($id, $onlyTrashed); @@ -56,8 +42,22 @@ public function export(array $filters) return $this->chatMessageRepository->list($filters); } + /** + * @return mixed + */ + public function list(array $filters = []) + { + return $this->chatMessageRepository->list($filters); + + } + public function import(array $filters) { return $this->chatMessageRepository->create($filters); } + + public function create(array $inputs = []) + { + return $this->chatMessageRepository->create($inputs); + } } diff --git a/src/Services/ChatParticipantService.php b/src/Services/ChatParticipantService.php index c9fb72a..8d36ad0 100644 --- a/src/Services/ChatParticipantService.php +++ b/src/Services/ChatParticipantService.php @@ -17,20 +17,6 @@ public function __construct(ChatParticipantRepository $chatParticipantRepository $this->chatParticipantRepository = $chatParticipantRepository; } - /** - * @return mixed - */ - public function list(array $filters = []) - { - return $this->chatParticipantRepository->list($filters); - - } - - public function create(array $inputs = []) - { - return $this->chatParticipantRepository->create($inputs); - } - public function find($id, $onlyTrashed = false) { return $this->chatParticipantRepository->find($id, $onlyTrashed); @@ -56,8 +42,22 @@ public function export(array $filters) return $this->chatParticipantRepository->list($filters); } + /** + * @return mixed + */ + public function list(array $filters = []) + { + return $this->chatParticipantRepository->list($filters); + + } + public function import(array $filters) { return $this->chatParticipantRepository->create($filters); } + + public function create(array $inputs = []) + { + return $this->chatParticipantRepository->create($inputs); + } } diff --git a/tests/TestCase.php b/tests/TestCase.php index 2e6dc82..2a65aed 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -10,6 +10,18 @@ class TestCase extends Orchestra { use DatabaseMigrations; + public function getEnvironmentSetUp($app): void + { + config()->set('app.env', 'testing'); + config()->set('database.default', 'testing'); + + $migrations = [ + ]; + foreach ($migrations as $migration) { + $migration->up(); + } + } + protected function setUp(): void { parent::setUp(); @@ -24,16 +36,4 @@ protected function getPackageProviders($app): array ChatServiceProvider::class, ]; } - - public function getEnvironmentSetUp($app): void - { - config()->set('app.env', 'testing'); - config()->set('database.default', 'testing'); - - $migrations = [ - ]; - foreach ($migrations as $migration) { - $migration->up(); - } - } }