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 ctrans('texts.user_not_associated_with_account'); } /** * @param $user_id * @return bool */ private function checkUserIsRelated($user_id) : bool { if (empty($user_id)) { return true; } return User::query() ->where('id', $user_id) ->where('account_id', auth()->user()->company()->account_id) ->exists(); } }