telephone field unique

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

telephone field unique

Post by VirtualSpy » 15 Dec 2022, 07:28

laravel version 9.36.4 , Aimeos version 2022.10.3 and PHP version 8.1.3 (Win)

I have made mandatory to telephone in billing & delivery address so, i want to know how to make telephone field unique like email from address form , means i want every user have diifferent telephone for order booking

User avatar
aimeos
Administrator
Posts: 7907
Joined: 01 Jan 1970, 00:00

Re: telephone field unique

Post by aimeos » 16 Dec 2022, 08:55

You can make the telephone field in the users table unique when a new user account is created in the ./setup/default/schema/customer.php of your own Aimeos extension:

Code: Select all

return [
  'table' => [
    'users' => function ( \Aimeos\Upscheme\Schema\Table $table ) {
        $table->unique( ['telephone'], 'unq_usr_telephone' );
    },
  ],
];
During checkout, the customer needs to be logged in to be able to check that. Then, it's done by the database when the customer record is updated after the address step.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply