From bbd507d9fccb4dd26c9b00cda48dcd347748bbc5 Mon Sep 17 00:00:00 2001 From: Dr Masroor Ehsan Date: Sat, 28 Dec 2024 12:48:11 +0600 Subject: [PATCH] wip --- app/Actions/Fortify/CreateNewUser.php | 7 +- app/Models/User.php | 5 + composer.json | 1 + composer.lock | 156 +++++++++++++++++++++++- phpunit.xml | 3 +- resources/views/auth/register.blade.php | 5 + 6 files changed, 171 insertions(+), 6 deletions(-) diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index c8ea461..16f22b4 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -22,8 +22,8 @@ public function create(array $input): User Validator::make($input, [ 'name' => ['required', 'string', 'max:255'], 'username' => ['required', 'string', 'max:255', 'unique:users'], - 'email' => ['required', 'string', 'email', 'max:255'], - 'phone' => ['required', 'regex:/(01)[0-9]{9}/'], + 'email' => ['string', 'email', 'max:255'], + 'phone' => ['phone:mobile'], 'password' => $this->passwordRules(), 'terms' => Jetstream::hasTermsAndPrivacyPolicyFeature() ? ['accepted', 'required'] : '', ])->validate(); @@ -32,7 +32,8 @@ public function create(array $input): User 'name' => $input['name'], 'username' => $input['username'], 'email' => $input['email'], - 'phone' => $input['phone'], + //'phone' => $input['phone'], + 'phone' => phone($input['phone'])->formatE164(), 'password' => Hash::make($input['password']), ]); } diff --git a/app/Models/User.php b/app/Models/User.php index b3298a1..5329407 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -30,7 +30,12 @@ class User extends Authenticatable */ protected $fillable = [ 'name', + 'username', 'email', + 'phone', + 'role', + 'site_id', + 'profile_photo_path', 'password', ]; diff --git a/composer.json b/composer.json index 00dfb7f..0f282cc 100644 --- a/composer.json +++ b/composer.json @@ -16,6 +16,7 @@ "laravel/sanctum": "^4.0", "laravel/tinker": "^2.9", "livewire/livewire": "^3.0", + "propaganistas/laravel-phone": "^5.3", "spatie/laravel-permission": "^6.10", "spatie/laravel-settings": "^3.4", "vinkla/hashids": "^12.0", diff --git a/composer.lock b/composer.lock index b7106ae..350ec03 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e8349b9d60d088e71a4d4c254ab6c7fe", + "content-hash": "365478437927a521db41a974981ba916", "packages": [ { "name": "bacon/bacon-qr-code", @@ -730,6 +730,89 @@ ], "time": "2023-10-12T05:21:21+00:00" }, + { + "name": "giggsey/libphonenumber-for-php-lite", + "version": "8.13.52", + "source": { + "type": "git", + "url": "https://github.com/giggsey/libphonenumber-for-php-lite.git", + "reference": "9d48e4e112d4a24d46a5fb7c65d000ca3d3faac1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/giggsey/libphonenumber-for-php-lite/zipball/9d48e4e112d4a24d46a5fb7c65d000ca3d3faac1", + "reference": "9d48e4e112d4a24d46a5fb7c65d000ca3d3faac1", + "shasum": "" + }, + "require": { + "php": "^8.1", + "symfony/polyfill-mbstring": "^1.17" + }, + "conflict": { + "giggsey/libphonenumber-for-php": "*" + }, + "require-dev": { + "ext-dom": "*", + "friendsofphp/php-cs-fixer": "^3.12", + "infection/infection": "^0.28", + "pear/pear-core-minimal": "^1.10.11", + "pear/pear_exception": "^1.0.2", + "pear/versioncontrol_git": "^0.7", + "phing/phing": "^2.17.4", + "phpstan/extension-installer": "^1.2", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-phpunit": "^1.2", + "phpunit/phpunit": "^10.5", + "symfony/console": "^6.0", + "symfony/var-exporter": "^6.0" + }, + "suggest": { + "giggsey/libphonenumber-for-php": "Use libphonenumber-for-php for geocoding, carriers, timezones and matching" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "8.x-dev" + } + }, + "autoload": { + "psr-4": { + "libphonenumber\\": "src/" + }, + "exclude-from-classmap": [ + "/src/data/", + "/src/carrier/data/", + "/src/geocoding/data/", + "/src/timezone/data/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Joshua Gigg", + "email": "giggsey@gmail.com", + "homepage": "https://giggsey.com/" + } + ], + "description": "A lite version of giggsey/libphonenumber-for-php, which is a PHP Port of Google's libphonenumber", + "homepage": "https://github.com/giggsey/libphonenumber-for-php-lite", + "keywords": [ + "geocoding", + "geolocation", + "libphonenumber", + "mobile", + "phonenumber", + "validation" + ], + "support": { + "issues": "https://github.com/giggsey/libphonenumber-for-php-lite/issues", + "source": "https://github.com/giggsey/libphonenumber-for-php-lite" + }, + "time": "2024-12-13T09:11:09+00:00" + }, { "name": "graham-campbell/manager", "version": "v5.1.0", @@ -3485,6 +3568,77 @@ }, "time": "2024-09-05T11:56:40+00:00" }, + { + "name": "propaganistas/laravel-phone", + "version": "5.3.3", + "source": { + "type": "git", + "url": "https://github.com/Propaganistas/Laravel-Phone.git", + "reference": "2172362ae5714ddc397d9df96a44b82bd125631a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Propaganistas/Laravel-Phone/zipball/2172362ae5714ddc397d9df96a44b82bd125631a", + "reference": "2172362ae5714ddc397d9df96a44b82bd125631a", + "shasum": "" + }, + "require": { + "giggsey/libphonenumber-for-php-lite": "^8.13.35", + "illuminate/contracts": "^10.0|^11.0", + "illuminate/support": "^10.0|^11.0", + "illuminate/validation": "^10.0|^11.0", + "php": "^8.1" + }, + "require-dev": { + "laravel/pint": "^1.14", + "orchestra/testbench": "*", + "phpunit/phpunit": "^10.5" + }, + "type": "library", + "extra": { + "laravel": { + "providers": [ + "Propaganistas\\LaravelPhone\\PhoneServiceProvider" + ] + } + }, + "autoload": { + "files": [ + "src/helpers.php" + ], + "psr-4": { + "Propaganistas\\LaravelPhone\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Propaganistas", + "email": "Propaganistas@users.noreply.github.com" + } + ], + "description": "Adds phone number functionality to Laravel based on Google's libphonenumber API.", + "keywords": [ + "laravel", + "libphonenumber", + "phone", + "validation" + ], + "support": { + "issues": "https://github.com/Propaganistas/Laravel-Phone/issues", + "source": "https://github.com/Propaganistas/Laravel-Phone/tree/5.3.3" + }, + "funding": [ + { + "url": "https://github.com/Propaganistas", + "type": "github" + } + ], + "time": "2024-12-27T11:45:47+00:00" + }, { "name": "psr/cache", "version": "3.0.0", diff --git a/phpunit.xml b/phpunit.xml index 506b9a3..c09b5bc 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -22,8 +22,7 @@ - - + diff --git a/resources/views/auth/register.blade.php b/resources/views/auth/register.blade.php index 3ed294a..160396f 100644 --- a/resources/views/auth/register.blade.php +++ b/resources/views/auth/register.blade.php @@ -24,6 +24,11 @@ +
+ + +
+