diff --git a/app/Http/Controllers/Factories/UserValidationRulesFactory.php b/app/Http/Controllers/Factories/UserValidationRulesFactory.php index d0081776..140cea81 100644 --- a/app/Http/Controllers/Factories/UserValidationRulesFactory.php +++ b/app/Http/Controllers/Factories/UserValidationRulesFactory.php @@ -54,6 +54,7 @@ final class UserValidationRulesFactory 'password' => 'sometimes|string|confirmed|password_policy', 'phone_number' => 'nullable|string', 'company' => 'nullable|string', + 'job_title' => 'nullable|string', // admin fields 'email_verified' => 'nullable|boolean', 'active' => 'nullable|boolean', @@ -87,6 +88,7 @@ final class UserValidationRulesFactory 'password' => 'sometimes|string|confirmed|password_policy', 'phone_number' => 'nullable|string', 'company' => 'nullable|string', + 'job_title' => 'nullable|string', // admin fields 'email_verified' => 'nullable|boolean', 'active' => 'nullable|boolean', diff --git a/app/ModelSerializers/Auth/UserSerializer.php b/app/ModelSerializers/Auth/UserSerializer.php index 7fef9e2c..c11a3aa2 100644 --- a/app/ModelSerializers/Auth/UserSerializer.php +++ b/app/ModelSerializers/Auth/UserSerializer.php @@ -42,6 +42,7 @@ final class PrivateUserSerializer extends BaseUserSerializer 'Email' => 'email:json_string', 'Bio' => 'bio:json_string', 'Company' => 'company:json_string', + 'JobTitle' => 'job_title:json_string', 'Gender' => 'gender:json_string', 'SpamType' => 'spam_type:json_string', 'Identifier' => 'identifier:json_string', diff --git a/app/libs/Auth/Factories/UserFactory.php b/app/libs/Auth/Factories/UserFactory.php index 3148e606..91217189 100644 --- a/app/libs/Auth/Factories/UserFactory.php +++ b/app/libs/Auth/Factories/UserFactory.php @@ -126,6 +126,9 @@ final class UserFactory if(isset($payload['company'])) $user->setCompany(trim($payload['company'])); + if(isset($payload['job_title'])) + $user->setJobTitle(trim($payload['job_title'])); + if(isset($payload['post_code'])) $user->setPostCode(trim($payload['post_code'])); diff --git a/app/libs/Auth/Models/User.php b/app/libs/Auth/Models/User.php index 78ae57ef..c5bc9097 100644 --- a/app/libs/Auth/Models/User.php +++ b/app/libs/Auth/Models/User.php @@ -288,6 +288,12 @@ class User extends BaseEntity */ private $company; + /** + * @ORM\Column(name="job_title", nullable=true, type="string") + * @var string + */ + private $job_title; + /** * @ORM\Column(name="phone_number", nullable=true, type="string") * @var string @@ -1757,4 +1763,21 @@ SQL; public static function getProfilePicFolder():string{ return self::ProfilePicFolder; } + + /** + * @return string + */ + public function getJobTitle(): ?string + { + return $this->job_title; + } + + /** + * @param string $job_title + */ + public function setJobTitle(string $job_title): void + { + $this->job_title = $job_title; + } + } \ No newline at end of file diff --git a/database/migrations/Version20201105184620.php b/database/migrations/Version20201105184620.php new file mode 100644 index 00000000..4156c145 --- /dev/null +++ b/database/migrations/Version20201105184620.php @@ -0,0 +1,49 @@ +hasTable("users") && !$builder->hasColumn("users","job_title") ) { + $builder->table('users', function (Table $table) { + $table->string('job_title')->setNotnull(false)->setLength(254); + }); + } + } + + /** + * @param Schema $schema + */ + public function down(Schema $schema) + { + $builder = new Builder($schema); + if($schema->hasTable("users") && $builder->hasColumn("users","job_title") ) { + $builder->table('users', function (Table $table) { + $table->dropColumn('job_title'); + }); + } + } +} diff --git a/resources/views/admin/edit-user.blade.php b/resources/views/admin/edit-user.blade.php index 70cb65c6..86e1cad9 100644 --- a/resources/views/admin/edit-user.blade.php +++ b/resources/views/admin/edit-user.blade.php @@ -152,18 +152,23 @@
-
- - -
+ value="{!! $user->company !!}" data-lpignore="true"> +
+
+ +
-
+
+ + +
+
+
+ + +
+
+ + +
+
- - -
-
-