1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/ValidationRules/UniqueUserRule.php
David Bomba cf1e65f1c0
ctrans() translator helper (#2621)
* Refactor  pivot table accessors

* Add select2 for client - country selector

* Fixes for client contact update

* implement ctrans() function across application

* Increase custom fields to 4 across the application

* Refactor: remove repos calling other repos, implement 4 custom values across application

* include querying the custom values in the client list

* Fix null custom value labels

* Scaffold for client - show view

* Working on Client Show
2019-01-25 21:47:23 +11:00

28 lines
539 B
PHP

<?php
namespace App\Http\ValidationRules;
use App\Libraries\MultiDB;
use App\Models\User;
use Illuminate\Contracts\Validation\Rule;
class UniqueUserRule implements Rule
{
public function passes($attribute, $value)
{
return ! $this->checkIfEmailExists($value); //if it exists, return false!
}
public function message()
{
return ctrans('texts.email_already_register');
}
private function checkIfEmailExists($email) : bool
{
return MultiDB::checkUserEmailExists($email);
}
}