input = $input; } /** * @param string $attribute * @param mixed $value * @return bool */ public function passes($attribute, $value) { return $this->checkUserIsRelated($value); } /** * @return string */ public function message() { return 'User not associated with this account'; } /** * @param $email * @return bool */ private function checkUserIsRelated($user_id) : bool { return User::query() ->where('id', $user_id) ->where('account_id', auth()->user()->company()->account_id) ->exists(); } }