From 370243933cdb3c264bf4f2490ec2c8a9f06995ee Mon Sep 17 00:00:00 2001 From: ilmedova Date: Tue, 4 Oct 2022 01:38:38 +0500 Subject: [PATCH] mail fixed for dynamic email from settings db --- app/Http/Controllers/API/AuthController.php | 12 +- app/Http/Controllers/API/TicketController.php | 22 +- .../Admin/TicketCrudController.php | 2 +- app/Providers/AppServiceProvider.php | 35 ++- .../views/admin/application_ticket.blade.php | 228 ++++++++++++++++++ routes/backpack/custom.php | 1 + routes/web.php | 1 + 7 files changed, 266 insertions(+), 35 deletions(-) create mode 100644 resources/views/admin/application_ticket.blade.php diff --git a/app/Http/Controllers/API/AuthController.php b/app/Http/Controllers/API/AuthController.php index 1f9f623f..41edf323 100755 --- a/app/Http/Controllers/API/AuthController.php +++ b/app/Http/Controllers/API/AuthController.php @@ -70,14 +70,14 @@ public function register(RegisterRequest $request){ { $client->verification_token = rand(10000, 99999); - try{ + //try{ Mail::to($request->email) ->queue(new EmailVerification($request->firstname, $client->verification_token)); - }catch (\Exception $ex){ - //eger email ugradyp bolmasa verification edip bolmaz - $client->is_verified = true; - Log::error($ex->getMessage()); - } + // }catch (\Exception $ex){ + // //eger email ugradyp bolmasa verification edip bolmaz + // $client->is_verified = true; + // Log::error($ex->getMessage()); + // } } diff --git a/app/Http/Controllers/API/TicketController.php b/app/Http/Controllers/API/TicketController.php index 5c5109b7..dc20a6ff 100755 --- a/app/Http/Controllers/API/TicketController.php +++ b/app/Http/Controllers/API/TicketController.php @@ -48,15 +48,10 @@ public function postMessage(MessageRequest $request) { try{ $message = new Message($request->only(['ticket_id', 'content'])); - $message['is_client'] = true; - $message->save(); - $ticket = Ticket::find($request->ticket_id); - $ticket['last_sender'] = 'client'; - $ticket->save(); return MessageResource::make($message); @@ -70,15 +65,10 @@ public function postMessageAdmin(MessageRequest $request) { try{ $message = new Message($request->only(['ticket_id', 'content', 'admin_id', 'status_id'])); - $message['is_client'] = false; - $message->save(); - $ticket = Ticket::find($request->ticket_id); - $ticket['last_sender'] = 'admin'; - $ticket->save(); return MessageResource::make($message); @@ -104,23 +94,21 @@ public function getTickets(Request $request) public function postTicket(TicketRequest $request) { $ticket = new Ticket($request->only('content', 'title','category_id')); - $client = $request->user(); $account = Account::find($client->account_id); - $ticket['client_id'] = $account->id; - $status = Status::where('name', 'Open')->firstOrFail(); - $ticket['status_id'] = $status->id; - $ticket['last_sender'] = 'client'; - $ticket->save(); Message::create(['ticket_id' => $ticket->id, 'content' => $request->get("content"),'is_client' => true]); - return TicketResource::make($ticket); } + //create ticket inside application preview - admin panel + public function createAppTicket(Request $request){ + $ticket = new Ticket($request->only('content', 'title','category_id', 'application_id')); + } + } diff --git a/app/Http/Controllers/Admin/TicketCrudController.php b/app/Http/Controllers/Admin/TicketCrudController.php index 2bdd48d4..8b3aa757 100755 --- a/app/Http/Controllers/Admin/TicketCrudController.php +++ b/app/Http/Controllers/Admin/TicketCrudController.php @@ -101,7 +101,7 @@ protected function setupCreateOperation() 'label' => "Account", 'type' => 'custom_select_account', 'name' => 'client_id', // the method that defines the relationship in your Model - 'entity' => 'client', // the method that defines the relationship in your Model + 'entity' => 'account', // the method that defines the relationship in your Model 'model' => "App\Models\Account", // foreign key model 'attribute_1' => 'name', // foreign key attribute that is shown to user 'attribute_2' => 'surname', diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index ee8ca5bc..93e59895 100755 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -6,16 +6,6 @@ class AppServiceProvider extends ServiceProvider { - /** - * Register any application services. - * - * @return void - */ - public function register() - { - // - } - /** * Bootstrap any application services. * @@ -23,6 +13,29 @@ public function register() */ public function boot() { - // + $this->overrideConfigValues(); } + + /** + * Register any application services. + * + * @return void + */ + public function register() + { + + } + + protected function overrideConfigValues() + { + $config = []; + $config['mail.mailers.smtp.host'] = config('settings.smtp_host'); + $config['mail.mailers.smtp.port'] = config('settings.smtp_port'); + $config['mail.mailers.smtp.encryption'] = config('settings.smtp_encryption'); + $config['mail.mailers.smtp.username'] = config('settings.smtp_username'); + $config['mail.mailers.smtp.password'] = config('settings.smtp_password'); + $config['mail.mailers.smtp.from.address'] = config('settings.smtp_username'); + $config['mail.mailers.smtp.from.name'] = 'Birzha Legalizasia'; + config($config); + } } diff --git a/resources/views/admin/application_ticket.blade.php b/resources/views/admin/application_ticket.blade.php new file mode 100644 index 00000000..1d0e6944 --- /dev/null +++ b/resources/views/admin/application_ticket.blade.php @@ -0,0 +1,228 @@ +@extends(backpack_view('blank')) + +@section('content') + + + + + +
+
+
+
+ @if($application->state == 'applied') + + + @else + + @endif + + + + +   + Create ticket + + @if ($application->account->type == 'business') +
+ +
Entreprenuer
+
+
+ +
{{ $application->account->country->name ?? null }}
+
+
+ +
{{ $application->account->profile->name ?? null }}
+
+
+ +
{{ $application->account->profile->surname ?? null }}
+
+
+ +
{{ $application->account->profile->patronomic_name ?? null }}
+
+ @if (isset($application->account->profile->date_of_birth)) +
+ +
{{ Carbon\Carbon::parse($application->account->profile->date_of_birth)->format('d.m.Y') }}
+
+ @endif +
+ +
{{ $application->account->profile->birth_place ?? null }}
+
+
+ +
{{ $application->account->profile->registration_address ?? null }}
+
+ @else +
+ +
Company
+
+
+ +
{{ $application->account->profile->name ?? null }}
+
+
+ +
{{ $application->account->profile->short_name ?? null }}
+
+
+ +
{{ $application->account->profile->registration_number ?? null }}
+
+ @if (isset($application->account->profile->registration_date)) +
+ +
{{ Carbon\Carbon::parse($application->account->profile->registration_date)->format('d.m.Y') }}
+
+ @endif +
+ +
{{ $application->account->profile->state_registration_agency ?? null }}
+
+
+ +
{{ $application->account->profile->registration_place ?? null }}
+
+
+ +
{{ $application->account->profile->registration_address ?? null }}
+
+
+ +
{{ $application->account->profile->fond_capital ?? null }}
+
+
+ +
{{ $application->account->profile->management_types ?? null }}
+
+
+ +
{{ $application->account->profile->signers ?? null }}
+
+
+ +
{{ $application->account->profile->share_holders ?? null }}
+
+
+ +
{{ $application->account->profile->organizational_form ?? null }}
+
+
+ +
{{ $application->account->profile->is_agent ?? false }}
+
+ @endif +
+
+
+ +
+ +
+
+ + + + + + + + + + @foreach ($application->attachments as $attachment) + @if ($attachment->file) + + + + + + @endif + @endforeach + +
NameSize (Kb)Type
+ + {{ $attachment->name }} + + + {{ $attachment->size }} Kb + + {{ $application->type }} +
+
+
+
+
+ + + +@endsection diff --git a/routes/backpack/custom.php b/routes/backpack/custom.php index 4b488c05..050f4106 100755 --- a/routes/backpack/custom.php +++ b/routes/backpack/custom.php @@ -43,5 +43,6 @@ Route::get('/preview-application/{id}',[ResourceController::class, 'previewApplicationAdmin']); Route::post('/approve-application/{id}', [ResourceController::class, 'approveApplication']); Route::get('/export-account-admin/{id}', [ExportController::class, 'export']); + Route::get('/create-application-ticket', [TicketController::class, 'createAppTicket']); }); // this should be the absolute last line of this file diff --git a/routes/web.php b/routes/web.php index 845d8893..840c8049 100755 --- a/routes/web.php +++ b/routes/web.php @@ -17,3 +17,4 @@ Route::get('/export-questionnaire/{token}',[ExportController::class, 'exportAccount']); Route::get('/set-lang', [LocalizationController::class, 'setLang']); +