From 8b560865fac4eab2adecc274ff895cbe743814cc Mon Sep 17 00:00:00 2001 From: Diatrex Date: Thu, 15 Oct 2020 15:38:28 +0300 Subject: [PATCH] #2362 ad post now working [URGENT] --- ....module.profile__create_birthday_field.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 addons/default/visiosoft/profile-module/migrations/2020_10_15_122457_visiosoft.module.profile__create_birthday_field.php diff --git a/addons/default/visiosoft/profile-module/migrations/2020_10_15_122457_visiosoft.module.profile__create_birthday_field.php b/addons/default/visiosoft/profile-module/migrations/2020_10_15_122457_visiosoft.module.profile__create_birthday_field.php new file mode 100644 index 000000000..c4741b263 --- /dev/null +++ b/addons/default/visiosoft/profile-module/migrations/2020_10_15_122457_visiosoft.module.profile__create_birthday_field.php @@ -0,0 +1,56 @@ +streams()->findBySlugAndNamespace('users', 'users')) { + $field = $this->fields() + ->newQuery() + ->where('slug', 'birthday') + ->where('namespace', 'users') + ->first(); + + if (!$field) { + $field = $this->fields()->create([ + 'name' => trans('visiosoft.module.profile::field.birthday.name'), + 'namespace' => 'users', + 'slug' => 'birthday', + 'type' => 'anomaly.field_type.datetime', + 'locked' => 0, + 'config' => [ + "mode" => "date", + "picker" => true, + ] + ]); + + $this->assignments()->create([ + 'stream_id' => $stream->id, + 'field_id' => $field->id + ]); + } + } + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + /* + * I never go back on my word! + * That's my nindo: my ninja way! + * NARUTO + */ + } +}