Skip to content

Commit

Permalink
Survey add HasMany columns + fix aod_index + fix survey data rows + s…
Browse files Browse the repository at this point in the history
…ort translations
  • Loading branch information
rxcod9 committed Jan 31, 2023
1 parent 7db3e82 commit a4366a8
Show file tree
Hide file tree
Showing 10 changed files with 740 additions and 607 deletions.
2 changes: 1 addition & 1 deletion database/seeders/AodIndex/DataTypesTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function run()
$dataType = $this->dataType('slug', 'aod-indexes');
if (!$dataType->exists) {
$dataType->fill([
'name' => 'aod_indexes',
'name' => 'aod_index',
'display_name_singular' => __('joy-voyager-crm::seeders.data_types.aod_index.singular'),
'display_name_plural' => __('joy-voyager-crm::seeders.data_types.aod_index.plural'),
'icon' => 'voyager-bread voyager-crm-aod_index voyager-key',
Expand Down
2 changes: 1 addition & 1 deletion database/seeders/AodIndex/PermissionsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ class PermissionsTableSeeder extends Seeder
*/
public function run()
{
Voyager::model('Permission')->generateFor('aod_indexes');
Voyager::model('Permission')->generateFor('aod_index');
}
}
10 changes: 5 additions & 5 deletions database/seeders/AodIndex/TranslationsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,17 @@ public function run()
*/
private function aodIndexesTranslations()
{
// Adding translations for 'aod_indexes'
// Adding translations for 'aod_index'
//
$cat = Voyager::model('AodIndex')->where('name', 'aod_index-1')->first();
if ($cat->exists) {
$this->trans('pt', $this->arr(['aod_indexes', 'name'], $cat->id), 'aod-index-1');
$this->trans('pt', $this->arr(['aod_indexes', 'description'], $cat->id), 'AodIndex 1');
$this->trans('pt', $this->arr(['aod_index', 'name'], $cat->id), 'aod-index-1');
$this->trans('pt', $this->arr(['aod_index', 'description'], $cat->id), 'AodIndex 1');
}
$cat = Voyager::model('AodIndex')->where('name', 'aod_index-2')->first();
if ($cat->exists) {
$this->trans('pt', $this->arr(['aod_indexes', 'name'], $cat->id), 'aod-index-2');
$this->trans('pt', $this->arr(['aod_indexes', 'description'], $cat->id), 'AodIndex 2');
$this->trans('pt', $this->arr(['aod_index', 'name'], $cat->id), 'aod-index-2');
$this->trans('pt', $this->arr(['aod_index', 'description'], $cat->id), 'AodIndex 2');
}
}

Expand Down
50 changes: 50 additions & 0 deletions database/seeders/Survey/DataRowsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,56 @@ public function run()
])->save();
}

$dataRow = $this->dataRow($dataType, 'survey_hasmany_surveyquestions_relationship');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'relationship',
'display_name' => __('joy-voyager-crm::seeders.data_rows.surveyquestions'),
'required' => 0,
'browse' => 0,
'read' => 0,
'edit' => 1,
'add' => 1,
'delete' => 0,
'order' => ++$order,
'details' => [
'model' => Voyager::modelClass('Surveyquestion'),
'table' => 'surveyquestions',
'type' => 'hasMany',
'column' => 'survey_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'surveyquestions',
'pivot' => 0,
],
])->save();
}

$dataRow = $this->dataRow($dataType, 'survey_hasmany_surveyresponses_relationship');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'relationship',
'display_name' => __('joy-voyager-crm::seeders.data_rows.surveyresponses'),
'required' => 0,
'browse' => 0,
'read' => 0,
'edit' => 1,
'add' => 0,
'delete' => 0,
'order' => ++$order,
'details' => [
'model' => Voyager::modelClass('Surveyresponse'),
'table' => 'surveyresponses',
'type' => 'hasMany',
'column' => 'survey_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'surveyresponses',
'pivot' => 0,
],
])->save();
}

$dataRow = $this->dataRow($dataType, 'created_at');
if (!$dataRow->exists) {
$dataRow->fill([
Expand Down
25 changes: 25 additions & 0 deletions database/seeders/Surveyquestion/DataRowsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,31 @@ public function run()
])->save();
}

$dataRow = $this->dataRow($dataType, 'survey_question_hasmany_surveyquestionoptions_relationship');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'relationship',
'display_name' => __('joy-voyager-crm::seeders.data_rows.surveyquestionoptions'),
'required' => 0,
'browse' => 0,
'read' => 0,
'edit' => 1,
'add' => 1,
'delete' => 0,
'order' => ++$order,
'details' => [
'model' => Voyager::modelClass('Surveyquestionoption'),
'table' => 'surveyquestionoptions',
'type' => 'hasMany',
'column' => 'survey_question_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'surveyquestionoptions',
'pivot' => 0,
],
])->save();
}

$dataRow = $this->dataRow($dataType, 'created_at');
if (!$dataRow->exists) {
$dataRow->fill([
Expand Down
15 changes: 15 additions & 0 deletions database/seeders/Surveyquestionresponse/DataRowsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,21 @@ public function run()
])->save();
}

$dataRow = $this->dataRow($dataType, 'name');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'text',
'display_name' => __('joy-voyager-crm::seeders.data_rows.name'),
'required' => 0,
'browse' => 1,
'read' => 1,
'edit' => 1,
'add' => 1,
'delete' => 1,
'order' => ++$order,
])->save();
}

$dataRow = $this->dataRow($dataType, 'description');
if (!$dataRow->exists) {
$dataRow->fill([
Expand Down
33 changes: 29 additions & 4 deletions database/seeders/Surveyresponse/DataRowsTableSeeder.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function run()
'model' => Voyager::modelClass('Account'),
'table' => 'accounts',
'type' => 'belongsTo',
'column' => 'accounts',
'column' => 'account_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'accounts',
Expand Down Expand Up @@ -162,7 +162,7 @@ public function run()
'model' => Voyager::modelClass('Campaign'),
'table' => 'campaigns',
'type' => 'belongsTo',
'column' => 'campaigns',
'column' => 'campaign_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'campaigns',
Expand Down Expand Up @@ -202,7 +202,7 @@ public function run()
'model' => Voyager::modelClass('Contact'),
'table' => 'contacts',
'type' => 'belongsTo',
'column' => 'contacts',
'column' => 'contact_id',
'key' => 'id',
'label' => 'first_name',
'pivot_table' => 'contacts',
Expand Down Expand Up @@ -242,7 +242,7 @@ public function run()
'model' => Voyager::modelClass('Survey'),
'table' => 'surveys',
'type' => 'belongsTo',
'column' => 'surveys',
'column' => 'survey_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'surveys',
Expand Down Expand Up @@ -291,6 +291,31 @@ public function run()
])->save();
}

$dataRow = $this->dataRow($dataType, 'survey_question_hasmany_surveyquestionresponses_relationship');
if (!$dataRow->exists) {
$dataRow->fill([
'type' => 'relationship',
'display_name' => __('joy-voyager-crm::seeders.data_rows.surveyquestionresponses'),
'required' => 0,
'browse' => 0,
'read' => 0,
'edit' => 1,
'add' => 1,
'delete' => 0,
'order' => ++$order,
'details' => [
'model' => Voyager::modelClass('Surveyquestionresponse'),
'table' => 'surveyquestionresponses',
'type' => 'hasMany',
'column' => 'surveyresponse_id',
'key' => 'id',
'label' => 'name',
'pivot_table' => 'surveyquestionresponses',
'pivot' => 0,
],
])->save();
}

$dataRow = $this->dataRow($dataType, 'created_at');
if (!$dataRow->exists) {
$dataRow->fill([
Expand Down
5 changes: 5 additions & 0 deletions resources/lang/en/generic.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

return [
//
];
Loading

0 comments on commit a4366a8

Please sign in to comment.