From 12d6a424b58e02fde838d294ab485ca56ec41700 Mon Sep 17 00:00:00 2001 From: merdan Date: Mon, 26 Sep 2022 16:05:01 +0500 Subject: [PATCH] all country --- app/Http/Controllers/API/ApplicationController.php | 4 +++- .../Controllers/Admin/DocumentCrudController.php | 14 ++++++++++++++ app/ProfileTypes/CompanyProfile.php | 2 +- .../2022_09_26_063449_alter_documents_table.php | 2 ++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/API/ApplicationController.php b/app/Http/Controllers/API/ApplicationController.php index b74e0802..4a27b376 100644 --- a/app/Http/Controllers/API/ApplicationController.php +++ b/app/Http/Controllers/API/ApplicationController.php @@ -57,7 +57,8 @@ public function create() //$docGroup = Documentgroup::withDocs($this->account->type,$this->account->country_id)->first(); $documents = Document::where($this->account->type,true) - ->whereHas('countries',function(Builder $query) { + ->where('all_country',true) + ->orWhereHas('countries',function(Builder $query) { $query->where('countries.id',$this->account->country_id); })->get(); @@ -137,6 +138,7 @@ public function apply() $app->state = 'applied'; $app->save(); + //todo send email to operators return response([ 'success' => true, 'message' => trans('app.app.application.app_success_message') diff --git a/app/Http/Controllers/Admin/DocumentCrudController.php b/app/Http/Controllers/Admin/DocumentCrudController.php index 0a06ef26..cf823a0f 100755 --- a/app/Http/Controllers/Admin/DocumentCrudController.php +++ b/app/Http/Controllers/Admin/DocumentCrudController.php @@ -68,6 +68,15 @@ protected function setupListOperation() 0 => 'No' ] ], + [ + 'name' => 'all_country', + 'type' => 'radio', + 'label' => 'All countries', + 'options' => [ + 1 => 'Yes', + 0 => 'No' + ] + ], [ 'label' => "Document Countries", 'type' => 'select_multiple', @@ -121,6 +130,11 @@ protected function setupCreateOperation() 'label' => 'Companies', 'type' => 'checkbox' ], + [ // Checkbox + 'name' => 'all_country', + 'label' => 'All countries', + 'type' => 'checkbox' + ], // [ // SelectMultiple = n-n relationship (with pivot table) // 'label' => "Document Groups", // 'type' => 'select_multiple', diff --git a/app/ProfileTypes/CompanyProfile.php b/app/ProfileTypes/CompanyProfile.php index d6cee224..3d43fc54 100644 --- a/app/ProfileTypes/CompanyProfile.php +++ b/app/ProfileTypes/CompanyProfile.php @@ -11,7 +11,7 @@ class CompanyProfile extends Profile { public $form = [ 'profile' => CompanyProfileRequest::class, - 'document' => CompanyProfileDocRequest::class + 'document' => CompanyProfileDocRequest::class, 'model' => Company::class, 'resource' => CompanyProfileResource::class ]; diff --git a/database/migrations/2022_09_26_063449_alter_documents_table.php b/database/migrations/2022_09_26_063449_alter_documents_table.php index 983718e1..871fb53a 100644 --- a/database/migrations/2022_09_26_063449_alter_documents_table.php +++ b/database/migrations/2022_09_26_063449_alter_documents_table.php @@ -16,6 +16,7 @@ public function up() Schema::table('documents', function (Blueprint $table) { $table->boolean('business')->default(0); $table->boolean('company')->default(0); + $table->boolean('all_country')->default(0); }); } @@ -29,6 +30,7 @@ public function down() Schema::table('documents', function (Blueprint $table) { $table->dropColumn('business'); $table->dropColumn('company'); +// $table->dropColumn('all_country'); }); } };