all country

This commit is contained in:
merdan 2022-09-26 16:05:01 +05:00
parent 9ca9271f5c
commit 12d6a424b5
4 changed files with 20 additions and 2 deletions

View File

@ -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')

View File

@ -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',

View File

@ -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
];

View File

@ -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');
});
}
};