App\Ninja\Repositories\AccountRepository::getUserAccounts PHP Method

getUserAccounts() public method

public getUserAccounts ( $record, $with = null )
    public function getUserAccounts($record, $with = null)
    {
        if (!$record) {
            return false;
        }
        $userIds = [];
        for ($i = 1; $i <= 5; $i++) {
            $field = "user_id{$i}";
            if ($record->{$field}) {
                $userIds[] = $record->{$field};
            }
        }
        $users = User::with('account')->whereIn('id', $userIds);
        if ($with) {
            $users->with($with);
        }
        return $users->get();
    }