Change validation rules to string
This commit is contained in:
@ -2,14 +2,10 @@
|
||||
|
||||
namespace App\Http\Requests\Portal;
|
||||
|
||||
use App\Traits\Contacts;
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
class Profile extends FormRequest
|
||||
{
|
||||
use Contacts;
|
||||
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
@ -35,20 +31,14 @@ class Profile extends FormRequest
|
||||
$picture = 'mimes:' . config('filesystems.mimes') . '|between:0,' . config('filesystems.max_size') * 1024;
|
||||
}
|
||||
|
||||
$email = [
|
||||
'required',
|
||||
'email',
|
||||
Rule::unique('users')
|
||||
->ignore($id)
|
||||
->where('deleted_at'),
|
||||
];
|
||||
$email = 'required|email|unique:users,email,' . $id . ',id,deleted_at,NULL';
|
||||
|
||||
if (user()->contact) {
|
||||
$email[] = Rule::unique('contacts')
|
||||
->ignore(user()->contact->id)
|
||||
->where('company_id', company_id())
|
||||
->where('type', $this->getCustomerTypes())
|
||||
->where('deleted_at');
|
||||
$email .= '|unique:contacts,NULL,'
|
||||
. user()->contact->id . ',id'
|
||||
. ',company_id,' . company_id()
|
||||
. ',type,customer'
|
||||
. ',deleted_at,NULL';
|
||||
}
|
||||
|
||||
return [
|
||||
|
Reference in New Issue
Block a user